More templating on post-ks scripts: if the server is a VM with Virtualbox, it is intended to be run from the global network, so the ansible ppa is installed from the web. If the server machine is not a VM, so it is plausible it has a local repo, so ansible package may be installed from the mirror.
This commit is contained in:
parent
e97bbdcf7d
commit
a2e9ac6678
@ -5,19 +5,19 @@ TARGETHOSTNAME=$(wget -qO- http://{{ ansible_local.domain.serverfqdn }}:3000/wha
|
|||||||
echo $TARGETHOSTNAME > /etc/hostname
|
echo $TARGETHOSTNAME > /etc/hostname
|
||||||
sed -i "s/kickseed/$TARGETHOSTNAME/g" /etc/hosts
|
sed -i "s/kickseed/$TARGETHOSTNAME/g" /etc/hosts
|
||||||
|
|
||||||
if ping -c4 8.8.8.8 >/dev/null 2>&1; then
|
{% if ansible_product_name != 'VirtualBox' %}
|
||||||
# Installo l'ultimo ansible per ansible-pull
|
# Installo l'ultimo ansible per ansible-pull
|
||||||
export https_proxy=https://{{ ansible_local.domain.serverip }}:3128
|
export https_proxy=https://{{ ansible_local.domain.serverip }}:3128
|
||||||
add-apt-repository -y ppa:ansible/ansible
|
add-apt-repository -y ppa:ansible/ansible
|
||||||
apt-get update && apt-get install -y ansible
|
apt-get update && apt-get install -y ansible
|
||||||
unset https_proxy
|
unset https_proxy
|
||||||
else
|
{% else %}
|
||||||
# Adding ansible manually from local
|
# Adding ansible manually from local
|
||||||
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ppa-ansible.gpg -O /tmp/ppa-ansible.gpg
|
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ppa-ansible.gpg -O /tmp/ppa-ansible.gpg
|
||||||
apt-key add /tmp/ppa-ansible.gpg && rm -f /tmp/ppa-ansible.gpg
|
apt-key add /tmp/ppa-ansible.gpg && rm -f /tmp/ppa-ansible.gpg
|
||||||
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-ansible-trusty.list -O /etc/apt/sources.list.d/ansible-ansible-trusty.list
|
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-ansible-trusty.list -O /etc/apt/sources.list.d/ansible-ansible-trusty.list
|
||||||
apt-get update && apt-get install -y ansible
|
apt-get update && apt-get install -y ansible
|
||||||
fi
|
{% endif %}
|
||||||
|
|
||||||
# Creo directory dipendenti
|
# Creo directory dipendenti
|
||||||
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 }}/config
|
||||||
|
@ -5,19 +5,19 @@ TARGETHOSTNAME=$(wget -qO- http://{{ ansible_local.domain.serverfqdn }}:3000/wha
|
|||||||
echo $TARGETHOSTNAME > /etc/hostname
|
echo $TARGETHOSTNAME > /etc/hostname
|
||||||
sed -i "s/kickseed/$TARGETHOSTNAME/g" /etc/hosts
|
sed -i "s/kickseed/$TARGETHOSTNAME/g" /etc/hosts
|
||||||
|
|
||||||
if ping -c4 8.8.8.8 >/dev/null 2>&1; then
|
{% if ansible_product_name != 'VirtualBox' %}
|
||||||
# Installo l'ultimo ansible per ansible-pull
|
# Installo l'ultimo ansible per ansible-pull
|
||||||
export https_proxy=https://{{ ansible_local.domain.serverip }}:3128
|
export https_proxy=https://{{ ansible_local.domain.serverip }}:3128
|
||||||
add-apt-repository -y ppa:ansible/ansible
|
add-apt-repository -y ppa:ansible/ansible
|
||||||
apt-get update && apt-get install -y ansible
|
apt-get update && apt-get install -y ansible
|
||||||
unset https_proxy
|
unset https_proxy
|
||||||
else
|
{% else %}
|
||||||
# Adding ansible manually from local
|
# Adding ansible manually from local
|
||||||
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ppa-ansible.gpg -O /tmp/ppa-ansible.gpg
|
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ppa-ansible.gpg -O /tmp/ppa-ansible.gpg
|
||||||
apt-key add /tmp/ppa-ansible.gpg && rm -f /tmp/ppa-ansible.gpg
|
apt-key add /tmp/ppa-ansible.gpg && rm -f /tmp/ppa-ansible.gpg
|
||||||
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-ansible-trusty.list -O /etc/apt/sources.list.d/ansible-ansible-trusty.list
|
wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-ansible-trusty.list -O /etc/apt/sources.list.d/ansible-ansible-trusty.list
|
||||||
apt-get update && apt-get install -y ansible
|
apt-get update && apt-get install -y ansible
|
||||||
fi
|
{% endif %}
|
||||||
|
|
||||||
# Creo directory dipendenti
|
# Creo directory dipendenti
|
||||||
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 }}/config
|
||||||
|
Loading…
x
Reference in New Issue
Block a user