This commit is contained in:
Brian Zalewski 2023-08-01 03:11:43 +00:00
parent a2575b19b3
commit 073d1923aa
4 changed files with 7 additions and 6 deletions

View file

@ -171,7 +171,7 @@ data:
- 10.0.0.0/24
- 10.14.50.0/24
- 192.168.1.0/24
qubes: {{ ne (stat (joinPath "usr" "bin" "qubes-session")) false }}
qubes: {{ stat (joinPath "usr" "bin" "qubes-session") }}
restricted: {{ $restricted }}
softwareGroup: "{{ $softwareGroup }}"
type: "{{ $chassisType }}"

View file

@ -26,8 +26,6 @@ ensureNetdataOwnership() {
### Claim the instance with Netdata Cloud
if command -v netdata-claim.sh > /dev/null; then
NETDATA_TOKEN="{{- if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_TOKEN")) -}}{{- includeTemplate "secrets/NETDATA_TOKEN" | decrypt | trim -}}{{- else -}}{{- env "NETDATA_TOKEN" -}}{{- end -}}"
NETDATA_ROOM="{{- if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_ROOM")) -}}{{- includeTemplate "secrets/NETDATA_ROOM" | decrypt | trim -}}{{- else -}}{{- env "NETDATA_ROOM" -}}{{- end -}}"
# Add user / group with script in ~/.local/bin/add-user, if it is available
if command -v add-user > /dev/null; then
sudo add-user netdata
@ -37,7 +35,7 @@ if command -v netdata-claim.sh > /dev/null; then
# netdata-claim.sh must be run as netdata user
logg info "Netdata room: $NETDATA_ROOM"
sudo -H -u netdata bash -c 'netdata-claim.sh -token="$NETDATA_TOKEN" -rooms="$NETDATA_ROOM" -url="{{ .netdataClaimURL }}"'
sudo -H -u netdata bash -c 'export NETDATA_ROOM="{{- if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_ROOM")) -}}{{- includeTemplate "secrets/NETDATA_ROOM" | decrypt | trim -}}{{- else -}}{{- env "NETDATA_ROOM" -}}{{- end -}}" && export NETDATA_TOKEN="{{- if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_TOKEN")) -}}{{- includeTemplate "secrets/NETDATA_TOKEN" | decrypt | trim -}}{{- else -}}{{- env "NETDATA_TOKEN" -}}{{- end -}}" && netdata-claim.sh -token="$NETDATA_TOKEN" -rooms="$NETDATA_ROOM" -url="{{ .netdataClaimURL }}"'
# Kernel optimizations
# These are mentioned while installing via the kickstart.sh script method. We are using Homebrew for the installation though.
@ -78,7 +76,7 @@ if command -v netdata-claim.sh > /dev/null; then
else
logg error 'No lib location found for netdata' && exit 1
fi
logg info "Copying $${XDG_CONFIG_HOME:-$HOME/.config}/netdata/health_alarm_notify.conf to $NETDATA_LIB/conf.d/health_alarm_notify.conf"
logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/netdata/health_alarm_notify.conf to $NETDATA_LIB/conf.d/health_alarm_notify.conf"
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/netdata/health_alarm_notify.conf" "$NETDATA_LIB/conf.d/health_alarm_notify.conf"
else
logg warn '`netdata` is not available in the PATH or is not installed'

View file

@ -236,6 +236,9 @@ fi
{{- $registrationToken := (includeTemplate (print "cloudflared/" .host.hostname) | decrypt) -}}
{{- end }}
### Set up CloudFlare tunnels
echo 'Registration token debug:'
echo -n '{{ includeTemplate (print "cloudflared/" .host.hostname) | decrypt }}'
echo '{{ $registrationToken }}'
if command -v cloudflared > /dev/null && [ -d "$HOME/.local/etc/cloudflared" ]; then
# Show warning message about ~/.cloudflared already existing
if [ -d "$HOME/.cloudflared" ]; then

View file

@ -1,5 +1,5 @@
{{- $baseDomain := (join (join .host.hostname ".") .host.domain) -}}
{{- if .host.qubes -}}
{{- if eq .host.qubes true -}}
{{- $baseDomain := (join (join .host.hostname "-qube.") .host.domain) -}}
{{- end -}}
---