2017-12-19 14:45:14 +00:00
|
|
|
---
|
|
|
|
# Create a virtualenv for ansible modules to use on the remote target systems
|
|
|
|
# when running kolla-ansible.
|
|
|
|
|
|
|
|
- name: Ensure a virtualenv exists for kolla-ansible
|
2018-05-10 09:17:50 +01:00
|
|
|
hosts: seed:overcloud
|
2017-12-19 14:45:14 +00:00
|
|
|
gather_facts: False
|
|
|
|
tags:
|
|
|
|
- kolla-ansible
|
|
|
|
- kolla-target-venv
|
|
|
|
tasks:
|
|
|
|
- block:
|
|
|
|
- name: Ensure the python-virtualenv package is installed
|
|
|
|
package:
|
|
|
|
name: python-virtualenv
|
|
|
|
state: installed
|
|
|
|
become: True
|
|
|
|
|
|
|
|
- name: Ensure kolla-ansible virtualenv has the latest version of pip installed
|
|
|
|
pip:
|
|
|
|
name: pip
|
|
|
|
state: latest
|
|
|
|
virtualenv: "{{ kolla_ansible_target_venv }}"
|
|
|
|
# Site packages are required for using the yum and selinux python
|
|
|
|
# modules, which are not available via PyPI.
|
|
|
|
virtualenv_site_packages: True
|
|
|
|
become: True
|
|
|
|
|
|
|
|
- name: Ensure kolla-ansible virtualenv has docker SDK for python installed
|
|
|
|
pip:
|
|
|
|
name: docker
|
|
|
|
state: latest
|
|
|
|
virtualenv: "{{ kolla_ansible_target_venv }}"
|
2018-02-26 16:37:30 +00:00
|
|
|
extra_args: "{% if kolla_upper_constraints_file %}-c {{ kolla_upper_constraints_file }}{% endif %}"
|
2017-12-19 14:45:14 +00:00
|
|
|
become: True
|
|
|
|
|
|
|
|
- name: Ensure kolla-ansible virtualenv has correct ownership
|
|
|
|
file:
|
|
|
|
path: "{{ kolla_ansible_target_venv }}"
|
|
|
|
recurse: True
|
|
|
|
state: directory
|
2018-07-09 15:45:16 +01:00
|
|
|
owner: "{{ kolla_ansible_user }}"
|
|
|
|
group: "{{ kolla_ansible_group }}"
|
2017-12-19 14:45:14 +00:00
|
|
|
become: True
|
|
|
|
when: kolla_ansible_target_venv is not none
|