From 2de8dbb24aa4009e0b22a870cd85d7531e36294b Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 17 Oct 2018 10:59:10 +0100 Subject: [PATCH] MNAIO: Use the OSA inventory and plugins where possible There are times when it's useful to run playbooks against the OSA inventory, but having to do so via infra1 is a bit of a pain. Rather than do that we add a script which fetches the OSA inventory file from infra1, and we also bootstrap the OSA plugins repo into the default ansible plugins path so that it is possible to run playbooks against the containers in the VM's from the host without needing to do anything else. Change-Id: I751af19841ea825d21dd67f4343674b8522b689f --- multi-node-aio/bootstrap.sh | 11 ++++++++++- multi-node-aio/playbooks/inventory/openstack-ansible | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 multi-node-aio/playbooks/inventory/openstack-ansible diff --git a/multi-node-aio/bootstrap.sh b/multi-node-aio/bootstrap.sh index 2c85d809..e7b0aecb 100755 --- a/multi-node-aio/bootstrap.sh +++ b/multi-node-aio/bootstrap.sh @@ -83,5 +83,14 @@ if [[ ${#BINDEP_PKGS} > 0 ]]; then esac fi -# install latest OSA supported Ansible version +# Install latest OSA supported Ansible version sudo pip install -r https://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt + +# Get the latest OSA plugins +# This is used to allow access from the MNAIO host to +# the entire OSA inventory directly, rather than having +# do execute things from infra1. +mkdir -p ~/.ansible +if [[ ! -d ~/.ansible/plugins ]]; then + git clone https://git.openstack.org/openstack/openstack-ansible-plugins ~/.ansible/plugins +fi diff --git a/multi-node-aio/playbooks/inventory/openstack-ansible b/multi-node-aio/playbooks/inventory/openstack-ansible new file mode 100755 index 00000000..a284bf29 --- /dev/null +++ b/multi-node-aio/playbooks/inventory/openstack-ansible @@ -0,0 +1,2 @@ +#!/bin/bash +ssh -q -ttt -o ConnectTimeout=1 -o StrictHostKeyChecking=no root@infra1 'OSA_INVENTORY_FILE="/etc/openstack_deploy/openstack_inventory.json"; if [[ -e ${OSA_INVENTORY_FILE} ]]; then cat ${OSA_INVENTORY_FILE}; else echo "{}"; fi' || echo "{}"