From 212f6958afd8c568412b8f732ec68f0f3063211c Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 9 Jul 2015 09:43:27 -0600 Subject: [PATCH] Cobbler: update CM repos before running ansible Signed-off-by: Zack Cerza --- roles/cobbler/defaults/main.yml | 7 +++++++ .../templates/triggers/install/post/cephlab_ansible.sh | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/roles/cobbler/defaults/main.yml b/roles/cobbler/defaults/main.yml index 41475d6d..658c4296 100644 --- a/roles/cobbler/defaults/main.yml +++ b/roles/cobbler/defaults/main.yml @@ -1,4 +1,11 @@ --- +# These defaults are present to allow certain tasks to no-op if a secrets repo +# hasn't been defined. If you want to override these, do so in the secrets repo +# itself. We override these in $repo/ansible/inventory/group_vars/cobbler.yml +secrets_repo: + name: UNDEFINED + url: null + # Where to download ISOs iso_dir: /var/lib/cobbler/isos # Mount point to use for ISOs during import diff --git a/roles/cobbler/templates/triggers/install/post/cephlab_ansible.sh b/roles/cobbler/templates/triggers/install/post/cephlab_ansible.sh index a884e301..f1cee1c5 100644 --- a/roles/cobbler/templates/triggers/install/post/cephlab_ansible.sh +++ b/roles/cobbler/templates/triggers/install/post/cephlab_ansible.sh @@ -5,6 +5,7 @@ name=$2 export USER=root export HOME=/root ANSIBLE_CM_PATH=/root/ceph-cm-ansible +SECRETS_REPO_NAME={{ secrets_repo.name }} # Bail if the ssh port isn't open, as will be the case when this is run # while the installer is still running. When this is triggered by @@ -13,7 +14,15 @@ nmap -sT -oG - -p 22 $name | grep 22/open mkdir -p /var/log/ansible +if [ $SECRETS_REPO_NAME != 'UNDEFINED' ] +then + ANSIBLE_SECRETS_PATH=/root/$SECRETS_REPO_NAME + pushd $ANSIBLE_SECRETS_PATH + git pull + popd +fi pushd $ANSIBLE_CM_PATH +git pull export ANSIBLE_SSH_PIPELINING=1 export ANSIBLE_HOST_KEY_CHECKING=False # Tell ansible to create users and populate authorized_keys -- 2.47.3