kayobe/ansible/kolla-target-venv.yml
Mark Goddard 41740f9752 Make kolla ansible user and group configurable
In some cases it is useful to use a user other than the default 'kolla'
to perform kolla ansible remote execution. Kolla is adding support for
this in the Rocky release, we should use it.

It is now possible to configure a different user via the
kolla_ansible_user and kolla_ansible_group variables.

Depends-On: https://review.openstack.org/581330

Change-Id: I280fb8f70eacd31fff0ae5671ddd6608cd02ae6e
Story: 2002914
Task: 22892
2018-07-10 14:12:39 +01:00

46 lines
1.5 KiB
YAML

---
# 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
hosts: seed:overcloud
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 }}"
extra_args: "{% if kolla_upper_constraints_file %}-c {{ kolla_upper_constraints_file }}{% endif %}"
become: True
- name: Ensure kolla-ansible virtualenv has correct ownership
file:
path: "{{ kolla_ansible_target_venv }}"
recurse: True
state: directory
owner: "{{ kolla_ansible_user }}"
group: "{{ kolla_ansible_group }}"
become: True
when: kolla_ansible_target_venv is not none