diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-04-12 12:04:12 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-04-12 12:09:28 +0200 |
commit | 4e8486c1a0453209043480eaf8b5769e70864420 (patch) | |
tree | 7d393b0cdaef94ca81856db3883b3baa9c94c539 /modules | |
parent | 528b0cf99b8e62789f982970ee3766ec4f54133f (diff) | |
download | Puppet-4e8486c1a0453209043480eaf8b5769e70864420.tar.gz Puppet-4e8486c1a0453209043480eaf8b5769e70864420.tar.zst Puppet-4e8486c1a0453209043480eaf8b5769e70864420.zip |
Add a way to specify a port for backup hosts
Diffstat (limited to 'modules')
4 files changed, 5 insertions, 2 deletions
diff --git a/modules/role/manifests/backup.pp b/modules/role/manifests/backup.pp index 6b8d00c..bdc35d5 100644 --- a/modules/role/manifests/backup.pp +++ b/modules/role/manifests/backup.pp | |||
@@ -70,6 +70,7 @@ class role::backup ( | |||
70 | $dirname = $infos["name"] | 70 | $dirname = $infos["name"] |
71 | $login = $infos["login"] | 71 | $login = $infos["login"] |
72 | $host = $infos["host"] | 72 | $host = $infos["host"] |
73 | $port = if $infos.dig("port") { $infos.dig("port") } else { 22 } | ||
73 | $dest = "$login@$host" | 74 | $dest = "$login@$host" |
74 | $base = "$mountpoint/$dirname" | 75 | $base = "$mountpoint/$dirname" |
75 | $nbr = $infos["nbr"] | 76 | $nbr = $infos["nbr"] |
diff --git a/modules/role/templates/backup/backup_dirname_head.sh.erb b/modules/role/templates/backup/backup_dirname_head.sh.erb index e20cfd3..15a0448 100644 --- a/modules/role/templates/backup/backup_dirname_head.sh.erb +++ b/modules/role/templates/backup/backup_dirname_head.sh.erb | |||
@@ -1,4 +1,5 @@ | |||
1 | ##### <%= @dirname %> ##### | 1 | ##### <%= @dirname %> ##### |
2 | PORT="<%= @port %>" | ||
2 | DEST="<%= @dest %>" | 3 | DEST="<%= @dest %>" |
3 | BASE="<%= @base %>" | 4 | BASE="<%= @base %>" |
4 | OLD_BAK_BASE=$BASE/older/j | 5 | OLD_BAK_BASE=$BASE/older/j |
@@ -10,6 +11,7 @@ if ! ssh \ | |||
10 | -o PreferredAuthentications=publickey \ | 11 | -o PreferredAuthentications=publickey \ |
11 | -o StrictHostKeyChecking=yes \ | 12 | -o StrictHostKeyChecking=yes \ |
12 | -o ClearAllForwardings=yes \ | 13 | -o ClearAllForwardings=yes \ |
14 | -p $PORT \ | ||
13 | $DEST backup; then | 15 | $DEST backup; then |
14 | echo "Fichier de verrouillage backup sur $DEST ou impossible de se connecter" >&2 | 16 | echo "Fichier de verrouillage backup sur $DEST ou impossible de se connecter" >&2 |
15 | skip=$DEST | 17 | skip=$DEST |
diff --git a/modules/role/templates/backup/backup_dirname_part.sh.erb b/modules/role/templates/backup/backup_dirname_part.sh.erb index ec662c4..77d4206 100644 --- a/modules/role/templates/backup/backup_dirname_part.sh.erb +++ b/modules/role/templates/backup/backup_dirname_part.sh.erb | |||
@@ -11,7 +11,7 @@ cat > $FILES_FROM <<EOF | |||
11 | EOF | 11 | EOF |
12 | 12 | ||
13 | OUT=$RSYNC_OUTPUT/$LOCAL | 13 | OUT=$RSYNC_OUTPUT/$LOCAL |
14 | rsync -XAavbrz --fake-super -e ssh --numeric-ids --delete \ | 14 | rsync -XAavbrz --fake-super -e "ssh -p $PORT" --numeric-ids --delete \ |
15 | --backup-dir=$BAK_BASE/$LOCAL \ | 15 | --backup-dir=$BAK_BASE/$LOCAL \ |
16 | <%- unless @args.empty? -%> | 16 | <%- unless @args.empty? -%> |
17 | <%= @args %>\ | 17 | <%= @args %>\ |
diff --git a/modules/role/templates/backup/backup_dirname_tail.sh.erb b/modules/role/templates/backup/backup_dirname_tail.sh.erb index 5027992..11de00c 100644 --- a/modules/role/templates/backup/backup_dirname_tail.sh.erb +++ b/modules/role/templates/backup/backup_dirname_tail.sh.erb | |||
@@ -1,4 +1,4 @@ | |||
1 | 1 | ||
2 | ssh $DEST sh -c "date > .cache/last_backup" | 2 | ssh -p $PORT $DEST sh -c "date > .cache/last_backup" |
3 | fi # [ "$skip" != "$DEST" ] | 3 | fi # [ "$skip" != "$DEST" ] |
4 | ##### End <%= @dirname %> ##### | 4 | ##### End <%= @dirname %> ##### |