2015-07-07 02:43:44 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-10-11 03:09:55 +02:00
|
|
|
# waiting for dns stack to be ready
|
|
|
|
while true; do
|
|
|
|
[[ "$(dig +short {{ ansible_local.domain.serverfqdn }})" == "{{ ansible_local.domain.serverip }}" ]] && break;
|
|
|
|
done
|
|
|
|
|
2015-10-02 02:42:35 +02:00
|
|
|
# Aggiorna crontab e logrotate forzosamente.
|
2015-10-11 02:09:06 +02:00
|
|
|
echo "$(date --rfc-3339=seconds) Loading and running init-ansible.sh"
|
2015-10-11 02:38:07 +02:00
|
|
|
/usr/bin/curl -sSL4 http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/init-ansible.sh | /bin/bash
|
2015-10-02 02:42:35 +02:00
|
|
|
|
2015-07-07 21:40:21 +02:00
|
|
|
# Script provvisorio.
|
|
|
|
# Potremmo decidere di far eseguire uno script generato da servizio
|
|
|
|
# domainhelper contenente anche l'eventuale branch da usare.
|
|
|
|
|
2015-07-22 00:24:00 +02:00
|
|
|
url=git://{{ ansible_local.domain.serverfqdn }}/client-pull-installation.git
|
|
|
|
repo=/var/lib/{{ ansible_local.domain.domainfull }}/config
|
2015-07-07 02:43:44 +02:00
|
|
|
logfile=/var/lib/ansible-pull.log
|
2016-02-18 22:29:01 +01:00
|
|
|
branch={{ ansible_local.domain.client_gitbranch }}
|
2015-07-07 21:40:21 +02:00
|
|
|
playbook=local.yml
|
2015-07-07 02:43:44 +02:00
|
|
|
|
2015-10-11 02:09:06 +02:00
|
|
|
echo "$(date --rfc-3339=seconds) Getting vault password"
|
2015-10-11 02:38:07 +02:00
|
|
|
vaultpassfile=$(/usr/bin/curl -sSL4 http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/getvaultpass.py | /usr/bin/python)
|
2015-07-14 22:01:41 +02:00
|
|
|
|
2015-10-11 02:09:06 +02:00
|
|
|
echo "$(date --rfc-3339=seconds) Running ansible-pull"
|
2016-02-20 01:06:33 +01:00
|
|
|
/usr/bin/ansible-pull --accept-host-key -i localhost -d "${repo}" -U "${url}" -C "${branch}" "${playbook}" --vault-password-file "${vaultpassfile}" $@
|
2015-07-14 22:01:41 +02:00
|
|
|
rm -f "${vaultpassfile}"
|