From 073d1923aafc0c8ac516f9905d9a293fb62536f0 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Tue, 1 Aug 2023 03:11:43 +0000 Subject: [PATCH] Latest --- home/.chezmoi.yaml.tmpl | 2 +- .../universal/run_onchange_after_57-netdata.sh.tmpl | 6 ++---- .../universal/run_onchange_after_97-cloudflare.sh.tmpl | 3 +++ home/dot_local/etc/cloudflared/config.yml.tmpl | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/home/.chezmoi.yaml.tmpl b/home/.chezmoi.yaml.tmpl index 39078461..3f2b9142 100644 --- a/home/.chezmoi.yaml.tmpl +++ b/home/.chezmoi.yaml.tmpl @@ -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 }}" diff --git a/home/.chezmoiscripts/universal/run_onchange_after_57-netdata.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_57-netdata.sh.tmpl index b53f51ea..7a22f0a2 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_57-netdata.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_57-netdata.sh.tmpl @@ -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' diff --git a/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl index 35123200..0a68f9d7 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl @@ -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 diff --git a/home/dot_local/etc/cloudflared/config.yml.tmpl b/home/dot_local/etc/cloudflared/config.yml.tmpl index 7de466b8..94d63326 100644 --- a/home/dot_local/etc/cloudflared/config.yml.tmpl +++ b/home/dot_local/etc/cloudflared/config.yml.tmpl @@ -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 -}} ---