diff options
author | Jesse Luehrs <doy@tozt.net> | 2018-10-19 23:20:08 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2018-10-19 23:20:08 -0400 |
commit | 1414e4b06f9a6eb43087acf445c90a7f89e617b3 (patch) | |
tree | cf18782b68d3f9f84eeec58cda3bc91252ab722b /bin | |
parent | a27c1db640342f482076fb9306363d909f89bcb4 (diff) | |
download | puppet-tozt-1414e4b06f9a6eb43087acf445c90a7f89e617b3.tar.gz puppet-tozt-1414e4b06f9a6eb43087acf445c90a7f89e617b3.zip |
start writing provisioning script for mail
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/helpers/launch-mail | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/bin/helpers/launch-mail b/bin/helpers/launch-mail index 91ba123..5198173 100755 --- a/bin/helpers/launch-mail +++ b/bin/helpers/launch-mail @@ -29,6 +29,35 @@ echo "Done assigning floating ip" echo "Provisioning droplet..." -# ... +host="${1:-newmail.tozt.net}" +conf_location="/usr/local/share/puppet-tozt" +conf_repo="git://github.com/doy/puppet-tozt" + +remote() { + # shellcheck disable=SC2029 + ssh root@"$host" "$@" +} + +ensure_conf_exists() { + 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" +} + +while ! remote true; do + sleep 5 +done + +remote apt-get update +remote apt-get upgrade +remote apt-get install git puppet + +ensure_conf_exists +scp -r /mnt/puppet/mail/ root@"$host":/usr/local/share/puppet-tozt/mail/secret/files +remote "cd '$conf_location' && puppet apply --modulepath=./mail -e 'include mail'" echo "Done" |