From 4a7651c6d24d8f0c27b2b641603ccc6d50394223 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 10 May 2018 09:56:46 -0500 Subject: [PATCH] Clean up docs and bootstrap script This change updates the bootstrap script to be cleaner and easier to use. This change updates the docs so they should now be a lot easier to follow. Change-Id: Ie2e5722dcaa229bdbec0e05bf994795f4cb10129 Signed-off-by: Kevin Carter --- elk_metrics_6x/ansible-role-requirements.yml | 9 +++ elk_metrics_6x/bootstrap-embedded-ansible.sh | 59 ++++++++++++----- elk_metrics_6x/readme.rst | 70 +++++++++++--------- 3 files changed, 90 insertions(+), 48 deletions(-) create mode 100644 elk_metrics_6x/ansible-role-requirements.yml diff --git a/elk_metrics_6x/ansible-role-requirements.yml b/elk_metrics_6x/ansible-role-requirements.yml new file mode 100644 index 00000000..73368833 --- /dev/null +++ b/elk_metrics_6x/ansible-role-requirements.yml @@ -0,0 +1,9 @@ +--- +- name: systemd_service + scm: git + src: https://git.openstack.org/openstack/ansible-role-systemd_service + version: master +- name: config_template + scm: git + src: https://git.openstack.org/openstack/ansible-config_template + version: master diff --git a/elk_metrics_6x/bootstrap-embedded-ansible.sh b/elk_metrics_6x/bootstrap-embedded-ansible.sh index ced3f144..5b814bc6 100644 --- a/elk_metrics_6x/bootstrap-embedded-ansible.sh +++ b/elk_metrics_6x/bootstrap-embedded-ansible.sh @@ -13,34 +13,59 @@ # See the License for the specific language governing permissions and # limitations under the License. -if [[ ! -f "/opt/ansible25/bin/ansible" ]]; then +export ANSIBLE_EMBED_HOME="${HOME}/ansible25" + +if [[ ! -e "${ANSIBLE_EMBED_HOME}/bin/ansible" ]]; then apt-get update - apt-get -y install python3-virtualenv || apt-get -y install python-virtualenv - virtualenv --python=/usr/bin/python3 /opt/ansible25 || virtualenv --python=/usr/bin/python2 /opt/ansible25 - /opt/ansible25/bin/pip install --upgrade ansible==2.5.2.0 --isolated + apt-get -y install python3-virtualenv python-virtualenv + if [[ -f "/usr/bin/python2" ]]; then + virtualenv --python="/usr/bin/python2" "${ANSIBLE_EMBED_HOME}" + elif [[ -f "/usr/bin/python3" ]]; then + virtualenv --python="/usr/bin/python3" "${ANSIBLE_EMBED_HOME}" + else + virtualenv "${ANSIBLE_EMBED_HOME}" + fi + eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade --force pip" + eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade ansible==2.5.2.0 --isolated" + echo "Ansible can be found here: ${ANSIBLE_EMBED_HOME}/bin" fi -if [[ ! -d "/opt/ansible25/repositories/ansible-config_template" ]]; then - mkdir -p /opt/ansible25/repositories - git clone https://github.com/openstack/ansible-config_template /opt/ansible25/repositories/ansible-config_template +if [[ ! -d "${ANSIBLE_EMBED_HOME}/repositories/ansible-config_template" ]]; then + mkdir -p "${ANSIBLE_EMBED_HOME}/repositories" + git clone https://git.openstack.org/openstack/ansible-config_template "${ANSIBLE_EMBED_HOME}/repositories/ansible-config_template" fi -if [[ ! -d "/opt/ansible25/repositories/roles/systemd_service" ]]; then - mkdir -p /opt/ansible25/repositories - git clone https://github.com/openstack/ansible-role-systemd_service /opt/ansible25/repositories/roles/systemd_service +if [[ ! -d "${ANSIBLE_EMBED_HOME}/repositories/roles/systemd_service" ]]; then + mkdir -p "${ANSIBLE_EMBED_HOME}/repositories" + git clone https://git.openstack.org/openstack/ansible-role-systemd_service "${ANSIBLE_EMBED_HOME}/repositories/roles/systemd_service" fi if [[ -f "/etc/openstack_deploy/openstack_inventory.json" ]]; then - mkdir -p /opt/ansible25/inventory - cat > /opt/ansible25/inventory/openstack_inventory.sh < "${ANSIBLE_EMBED_HOME}/inventory/openstack_inventory.sh" <