2015-07-07 01:37:47 +02:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# Cambio username con quello fornito da servizio
|
2015-09-07 22:06:17 +02:00
|
|
|
|
TARGETHOSTNAME=$(wget -qO- http://{{ ansible_local.domain.serverfqdn }}:3000/whatsmyhostname?role=docenti)
|
2015-07-07 01:37:47 +02:00
|
|
|
|
echo $TARGETHOSTNAME > /etc/hostname
|
|
|
|
|
sed -i "s/kickseed/$TARGETHOSTNAME/g" /etc/hosts
|
|
|
|
|
|
|
|
|
|
# Installo l'ultimo ansible per ansible-pull
|
2015-07-22 00:24:00 +02:00
|
|
|
|
export https_proxy=https://{{ ansible_local.domain.serverip }}:3128
|
2015-07-07 01:37:47 +02:00
|
|
|
|
add-apt-repository -y ppa:ansible/ansible
|
|
|
|
|
apt-get update && apt-get install -y ansible
|
|
|
|
|
unset https_proxy
|
2015-07-07 02:43:44 +02:00
|
|
|
|
|
|
|
|
|
# Creo directory dipendenti
|
2015-07-22 00:24:00 +02:00
|
|
|
|
install -d -o root -g root /var/lib/{{ ansible_local.domain.domainfull }}/config
|
|
|
|
|
install -d -o root -g root /var/lib/{{ ansible_local.domain.domainfull }}/bin
|
2015-07-07 02:43:44 +02:00
|
|
|
|
|
2015-07-13 23:57:01 +02:00
|
|
|
|
# Installo lo script per la decrittazione della password del vault
|
2015-07-22 01:01:41 +02:00
|
|
|
|
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/getvaultpass.py -O /tmp/getvaultpass.py
|
2015-07-22 00:24:00 +02:00
|
|
|
|
install -m744 -o root -g root /tmp/getvaultpass.py /var/lib/{{ ansible_local.domain.domainfull}}/bin/getvaultpass.py
|
2015-07-14 21:42:16 +02:00
|
|
|
|
rm -f /tmp/getvaultpass.py
|
2015-07-13 23:57:01 +02:00
|
|
|
|
|
2015-07-07 02:43:44 +02:00
|
|
|
|
# Installo lo script per l'avvio di ansible-pull da root
|
2015-07-22 01:01:41 +02:00
|
|
|
|
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/run.sh -O /tmp/ansible-pull.sh
|
2015-07-22 00:24:00 +02:00
|
|
|
|
install -m744 -o root -g root /tmp/ansible-pull.sh /var/lib/{{ ansible_local.domain.domainfull }}/bin/ansible-pull.sh
|
2015-07-07 02:43:44 +02:00
|
|
|
|
rm -f /tmp/ansible-pull.sh
|
|
|
|
|
|
|
|
|
|
# Installo il cronjob
|
2015-07-22 01:01:41 +02:00
|
|
|
|
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/crontab -O /tmp/ansible-pull-crontab
|
2015-07-07 02:43:44 +02:00
|
|
|
|
install -m644 -o root -g root /tmp/ansible-pull-crontab /etc/cron.d/ansible-pull
|
|
|
|
|
rm -f /tmp/ansible-pull-crontab
|
|
|
|
|
# Installo il logrotate
|
2015-07-22 01:01:41 +02:00
|
|
|
|
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/logrotate -O /tmp/ansible-pull-logrotate
|
2015-07-15 00:22:51 +02:00
|
|
|
|
install -m644 -o root -g root /tmp/ansible-pull-logrotate /etc/logrotate.d/ansible
|
2015-07-07 02:43:44 +02:00
|
|
|
|
rm -f /tmp/ansible-pull-logrotate
|