diff options
| -rw-r--r-- | frontends/Rexfile | 13 | ||||
| -rw-r--r-- | frontends/scripts/gemtexter.sh.tpl | 3 | ||||
| -rw-r--r-- | frontends/scripts/rsync.sh.tpl | 8 |
3 files changed, 22 insertions, 2 deletions
diff --git a/frontends/Rexfile b/frontends/Rexfile index 6919918..df68d2c 100644 --- a/frontends/Rexfile +++ b/frontends/Rexfile @@ -113,18 +113,29 @@ desc 'Setup rsync'; task 'rsync', group => 'frontends', sub { pkg 'rsync', ensure => present; + file '/etc/rsyncd.conf', content => template('./etc/rsyncd.conf.tpl'), owner => 'root', group => 'wheel', mode => '644'; + + file '/usr/local/bin/rsync.sh', + content => template('./scripts/rsync.sh.tpl', + is_primary => $is_primary), + owner => 'root', + group => 'wheel', + mode => '755'; + + append_if_no_such_line '/etc/daily.local', '/usr/local/bin/rsync.sh'; }; desc 'Configure the gemtexter sites'; task 'gemtexter', group => 'frontends', sub { file '/usr/local/bin/gemtexter.sh', - content => template('./scripts/gemtexter.sh.tpl'), + content => template('./scripts/gemtexter.sh.tpl', + is_primary => $is_primary), owner => 'root', group => 'wheel', mode => '744'; diff --git a/frontends/scripts/gemtexter.sh.tpl b/frontends/scripts/gemtexter.sh.tpl index e62d050..8b0e524 100644 --- a/frontends/scripts/gemtexter.sh.tpl +++ b/frontends/scripts/gemtexter.sh.tpl @@ -23,6 +23,7 @@ function ensure_site { fi } +<% if ($is_primary->($vio0_ip)) { %> for site in foo.zone snonux.land paul.buetow.org; do ensure_site \ /var/gemini/$site \ @@ -33,4 +34,4 @@ for site in foo.zone snonux.land paul.buetow.org; do https://codeberg.org/snonux/$site \ content-html done - +<% } %> diff --git a/frontends/scripts/rsync.sh.tpl b/frontends/scripts/rsync.sh.tpl new file mode 100644 index 0000000..c55a86b --- /dev/null +++ b/frontends/scripts/rsync.sh.tpl @@ -0,0 +1,8 @@ +#!/bin/sh + +PATH=$PATH:/usr/local/bin + +<% unless ($is_primary->($vio0_ip)) { %> +/usr/local/bin/rsync -av --delete rsync://blowfish.buetow.org/publicgemini/ /var/gemini +/usr/local/bin/rsync -av --delete rsync://blowfish.buetow.org/publichttp/ /var/www/htdocs +<% } %> |
