summaryrefslogtreecommitdiffstats
path: root/bin/helpers/launch-partofme
blob: 7d4ae996e19e30cc3b5437e3359ec5bcce336d41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
set -eu
set -o pipefail

host="${1:-partofme}"
conf_location="/usr/local/share/puppet-tozt"
conf_repo="git://github.com/doy/puppet-tozt"

remote() {
    # shellcheck disable=SC2029
    ssh root@"$host" "$@"
}

if remote test -d "$conf_location"; then
    remote "cd '$conf_location' && git pull"
else
    remote "mkdir -p '$conf_location'"
    remote "cd '$conf_location' && git clone '$conf_repo' ."
fi
remote "cd '$conf_location' && git submodule update --init --recursive"

scp -r /mnt/puppet/tozt/ root@"$host":/usr/local/share/puppet-tozt/modules/secret/files
remote "cd '$conf_location' && puppet apply --modulepath=./modules manifests"

echo "Done"