From 0ab800593fd3afc5fd7d951be69f0fa720ac52bb Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Wed, 8 Apr 2020 13:53:58 +0100 Subject: [PATCH] Add ansible openstack collection This requires at least ansible version 2.9. A new requirements file is added to specify collections, and the bootstrap-ansible script is modified to install the openstack collection alongside the OSA ansible roles. Change-Id: I553e9edf5d7e81e38438511a52e8cbee36589bdd --- ansible-collection-requirements.yml | 4 ++++ scripts/bootstrap-ansible.sh | 3 +++ scripts/openstack-ansible.rc | 2 ++ 3 files changed, 9 insertions(+) create mode 100644 ansible-collection-requirements.yml diff --git a/ansible-collection-requirements.yml b/ansible-collection-requirements.yml new file mode 100644 index 0000000000..3f14211724 --- /dev/null +++ b/ansible-collection-requirements.yml @@ -0,0 +1,4 @@ +collections: + - name: openstack.cloud + version: 1.0.0 + source: https://galaxy.ansible.com diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index b1ddc4ad01..dcd63a017a 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -24,6 +24,7 @@ export HTTPS_PROXY=${HTTPS_PROXY:-""} # The Ansible version used for testing export ANSIBLE_PACKAGE=${ANSIBLE_PACKAGE:-"ansible==2.9.9"} export ANSIBLE_ROLE_FILE=${ANSIBLE_ROLE_FILE:-"ansible-role-requirements.yml"} +export ANSIBLE_COLLECTION_FILE=${ANSIBLE_COLLECTION_FILE:-"ansible-collection-requirements.yml"} export USER_ROLE_FILE=${USER_ROLE_FILE:-"user-role-requirements.yml"} export SSH_DIR=${SSH_DIR:-"/root/.ssh"} export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-"noninteractive"} @@ -154,6 +155,8 @@ pushd /opt/ansible-runtime/bin done popd +/opt/ansible-runtime/bin/ansible-galaxy collection install -r ${ANSIBLE_COLLECTION_FILE} -p /etc/ansible + # Write the OSA Ansible rc file sed "s|OSA_INVENTORY_PATH|${OSA_INVENTORY_PATH}|g" scripts/openstack-ansible.rc > /usr/local/bin/openstack-ansible.rc sed -i "s|OSA_PLAYBOOK_PATH|${OSA_PLAYBOOK_PATH}|g" /usr/local/bin/openstack-ansible.rc diff --git a/scripts/openstack-ansible.rc b/scripts/openstack-ansible.rc index 539c0de1d2..ea34699762 100644 --- a/scripts/openstack-ansible.rc +++ b/scripts/openstack-ansible.rc @@ -23,6 +23,8 @@ mkdir -p "$(dirname ${ANSIBLE_LOG_PATH})" || unset ANSIBLE_LOG_PATH export ANSIBLE_ROLES_PATH="${ANSIBLE_ROLES_PATH:-/etc/ansible/roles:OSA_PLAYBOOK_PATH/roles:/etc/ansible/roles/ceph-ansible/roles}" +export ANSIBLE_COLLECTIONS_PATHS="${ANSIBLE_COLLECTIONS_PATHS:-/etc/ansible}" + export ANSIBLE_LIBRARY="${ANSIBLE_LIBRARY:-/etc/ansible/roles/config_template/library:/etc/ansible/roles/plugins/library:/etc/ansible/roles/ceph-ansible/library}" export ANSIBLE_LOOKUP_PLUGINS="${ANSIBLE_LOOKUP_PLUGINS:-/etc/ansible/roles/plugins/lookup}" export ANSIBLE_FILTER_PLUGINS="${ANSIBLE_FILTER_PLUGINS:-/etc/ansible/roles/plugins/filter:/etc/ansible/roles/ceph-ansible/plugins/filter}"