openstack-ansible-ops/bootstrap-embedded-ansible/embedded-ansible-setup.yml
Kevin Carter 7491b6df8e Update the embedded-ansible-setup process to be configurable
This change allows the embedded ansible process to be configurable by
the end user.
  * Python requirements and ansible roles will all now be user
    configurable.
  * Setup is now a local only playbook. This playbook replaces the bash
    commands we were rerunning when the `bootstrap-embedded-ansible.sh`
    script was executed.
  * Embedded ansible version is now 2.7.5 as default.
  * Deprecation warnings have been resolved.
  * Tests impacted by this change have been updated.

Change-Id: I4303c44e249cda31457a4f05a681e298d225a8b7
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2019-01-04 11:46:19 -06:00

35 lines
1.0 KiB
YAML

---
- name: Setup embedded ansible
hosts: localhost
connection: local
user: root
gather_facts: no
vars:
default_ansible_venv_path: "{{ lookup('env','HOME') + '/ansible_venv' }}"
tasks:
- name: Ensure pip packages are installed
pip:
requirements: "{{ ansible_python_requirement_file | default('python-requirements.txt') }}"
virtualenv: "{{ ansible_venv_path | default(default_ansible_venv_path) }}"
extra_args: '--isolated'
- name: Check for OSA inventory
stat:
path: /etc/openstack_deploy/openstack_inventory.json
register: osa_inventory
- name: osa block
block:
- name: Create inventory shim directory
file:
path: "{{ default_ansible_venv_path }}/inventory"
state: "directory"
- name: Copy embedded ansible inventory shim
copy:
dest: "{{ default_ansible_venv_path }}/inventory/openstack_inventory.sh"
src: osa-inventory.sh
mode: '0755'
when:
- osa_inventory.stat.exists | bool