2015-10-02 02:33:59 +02:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
2017-10-24 21:44:42 +02:00
|
|
|
|
# Fixing base variables.
|
|
|
|
|
basedir=/var/lib/{{ ansible_local.domain.domainfull }}
|
|
|
|
|
url=git://{{ ansible_local.domain.serverfqdn }}/client-pull-installation.git
|
|
|
|
|
branch={{ ansible_local.domain.client_gitbranch }}
|
|
|
|
|
|
2015-10-02 02:33:59 +02:00
|
|
|
|
# Creo directory dipendenti
|
2016-02-18 22:29:01 +01:00
|
|
|
|
echo "$(date --rfc-3339=seconds) Installing bin directory."
|
2017-10-24 21:44:42 +02:00
|
|
|
|
/usr/bin/install -d -o root -g users ${basedir}/bin
|
|
|
|
|
|
|
|
|
|
# Workaround issue #23 - ansible-pull won't pull out of remote the first time.
|
|
|
|
|
if [[ ! -f ${basedir}/config/local.yml ]]; then
|
|
|
|
|
/usr/bin/git clone -b ${branch} ${url} ${basedir}/config
|
|
|
|
|
fi
|
2015-10-02 02:33:59 +02:00
|
|
|
|
|
2015-10-11 02:57:48 +02:00
|
|
|
|
# Installo ansible-pull.sh
|
|
|
|
|
echo "$(date --rfc-3339=seconds) Creating ansible-pull.sh."
|
2017-10-24 21:44:42 +02:00
|
|
|
|
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/ansible-pull.sh -O ${basedir}/bin/ansible-pull.sh
|
|
|
|
|
chmod a+x ${basedir}/bin/ansible-pull.sh
|
|
|
|
|
|
|
|
|
|
# Fixing permissions on the main directory
|
|
|
|
|
/bin/chown -R root:users ${basedir}
|
2015-10-11 02:57:48 +02:00
|
|
|
|
|
2015-10-02 02:33:59 +02:00
|
|
|
|
# Installo il cronjob per ansible-pull
|
2015-10-11 02:09:06 +02:00
|
|
|
|
echo "$(date --rfc-3339=seconds) Creating crontab"
|
2015-10-11 02:04:15 +02:00
|
|
|
|
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/crontab -O /etc/cron.d/ansible-pull
|
|
|
|
|
/bin/chown root:root /etc/cron.d/ansible-pull
|
|
|
|
|
/bin/chmod 0644 /etc/cron.d/ansible-pull
|
2015-10-02 02:33:59 +02:00
|
|
|
|
|
|
|
|
|
# Installo il logrotate per ansible
|
2015-10-11 02:09:06 +02:00
|
|
|
|
echo "$(date --rfc-3339=seconds) Creating logrotate"
|
2015-10-11 02:04:15 +02:00
|
|
|
|
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/logrotate -O /etc/logrotate.d/ansible-pull
|
|
|
|
|
/bin/chown root:root /etc/logrotate.d/ansible-pull
|
|
|
|
|
/bin/chmod 0644 /etc/logrotate.d/ansible-pull
|