From a2e9ac667809578aaf51aeb4dd0a28d4aca4826f Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Mon, 21 Sep 2015 00:58:56 +0200 Subject: [PATCH] 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. --- roles/kickstart/templates/post-client-ks.sh | 26 ++++++++++---------- roles/kickstart/templates/post-docenti-ks.sh | 26 ++++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/roles/kickstart/templates/post-client-ks.sh b/roles/kickstart/templates/post-client-ks.sh index 72b5c08..ce3a969 100644 --- a/roles/kickstart/templates/post-client-ks.sh +++ b/roles/kickstart/templates/post-client-ks.sh @@ -5,19 +5,19 @@ TARGETHOSTNAME=$(wget -qO- http://{{ ansible_local.domain.serverfqdn }}:3000/wha echo $TARGETHOSTNAME > /etc/hostname sed -i "s/kickseed/$TARGETHOSTNAME/g" /etc/hosts -if ping -c4 8.8.8.8 >/dev/null 2>&1; then - # Installo l'ultimo ansible per ansible-pull - export https_proxy=https://{{ ansible_local.domain.serverip }}:3128 - add-apt-repository -y ppa:ansible/ansible - apt-get update && apt-get install -y ansible - unset https_proxy -else - # Adding ansible manually from local - 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 - 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 -fi +{% if ansible_product_name != 'VirtualBox' %} +# Installo l'ultimo ansible per ansible-pull +export https_proxy=https://{{ ansible_local.domain.serverip }}:3128 +add-apt-repository -y ppa:ansible/ansible +apt-get update && apt-get install -y ansible +unset https_proxy +{% else %} +# Adding ansible manually from local +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 +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 +{% endif %} # Creo directory dipendenti install -d -o root -g root /var/lib/{{ ansible_local.domain.domainfull }}/config diff --git a/roles/kickstart/templates/post-docenti-ks.sh b/roles/kickstart/templates/post-docenti-ks.sh index b3cbf01..df52a80 100644 --- a/roles/kickstart/templates/post-docenti-ks.sh +++ b/roles/kickstart/templates/post-docenti-ks.sh @@ -5,19 +5,19 @@ TARGETHOSTNAME=$(wget -qO- http://{{ ansible_local.domain.serverfqdn }}:3000/wha echo $TARGETHOSTNAME > /etc/hostname sed -i "s/kickseed/$TARGETHOSTNAME/g" /etc/hosts -if ping -c4 8.8.8.8 >/dev/null 2>&1; then - # Installo l'ultimo ansible per ansible-pull - export https_proxy=https://{{ ansible_local.domain.serverip }}:3128 - add-apt-repository -y ppa:ansible/ansible - apt-get update && apt-get install -y ansible - unset https_proxy -else - # Adding ansible manually from local - 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 - 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 -fi +{% if ansible_product_name != 'VirtualBox' %} +# Installo l'ultimo ansible per ansible-pull +export https_proxy=https://{{ ansible_local.domain.serverip }}:3128 +add-apt-repository -y ppa:ansible/ansible +apt-get update && apt-get install -y ansible +unset https_proxy +{% else %} +# Adding ansible manually from local +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 +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 +{% endif %} # Creo directory dipendenti install -d -o root -g root /var/lib/{{ ansible_local.domain.domainfull }}/config