Files
kayobe/ansible/roles/kolla-ansible/tasks/install.yml
Mark Goddard 9831302ea4 Update python dependencies in kolla-ansible virtualenv
If upgrading the kayobe control host environment via kayobe control host
upgrade, kolla-ansible will be upgraded in its virtual environment if
the specified source repo and version are different than those
installed. However, other dependencies, including ansible, will
not be upgraded unless the version constraints require it. Ansible is
specified with an upper bound on the version, so typically this will be
satisfied during an upgrade and will not trigger an upgrade.

This change uses the 'latest' state for the pip module to ensure
packages are updated.

Change-Id: Ica38a1cdfb57c4be81468607800b26fdf3209fe7
Story: 2003878
Task: 26737
2018-09-26 13:06:54 +00:00

79 lines
2.4 KiB
YAML

---
- name: Include OS family-specific variables
include_vars: "{{ ansible_os_family }}.yml"
- name: Ensure EPEL repo is installed
yum:
name: epel-release
state: installed
become: True
when:
- ansible_os_family == 'RedHat'
- kolla_ansible_install_epel | bool
- name: Ensure required packages are installed
package:
name: "{{ item }}"
state: installed
become: True
with_items: "{{ kolla_ansible_package_dependencies }}"
- name: Ensure source code checkout parent directory exists
file:
path: "{{ kolla_ansible_source_path | dirname }}"
state: directory
owner: "{{ ansible_user_uid }}"
group: "{{ ansible_user_gid }}"
become: True
when: kolla_ansible_ctl_install_type == 'source'
- name: Ensure Kolla Ansible source code checkout exists
git:
repo: "{{ kolla_ansible_source_url }}"
dest: "{{ kolla_ansible_source_path }}"
version: "{{ kolla_ansible_source_version }}"
when: kolla_ansible_ctl_install_type == 'source'
- name: Ensure virtualenv parent directory exists
file:
path: "{{ kolla_ansible_venv | dirname }}"
state: directory
owner: "{{ ansible_user_uid }}"
group: "{{ ansible_user_gid }}"
become: True
when: kolla_ansible_venv is not none
- name: Ensure the latest version of pip is installed
pip:
name: "{{ item.name }}"
state: latest
virtualenv: "{{ kolla_ansible_venv }}"
with_items:
- { name: pip }
- name: Ensure python requirements file exists
template:
src: requirements.txt.j2
dest: "{{ kolla_ansible_venv }}/requirements.txt"
- name: Ensure required Python packages are installed
pip:
requirements: "{{ kolla_ansible_venv }}/requirements.txt"
state: latest
extra_args: "{% if kolla_upper_constraints_file %}-c {{ kolla_upper_constraints_file }}{% endif %}"
virtualenv: "{{ kolla_ansible_venv }}"
# This is a workaround for the lack of a python package for libselinux-python
# on PyPI. Without using --system-site-packages to create the virtualenv, it
# seems difficult to ensure the selinux python module is available. It is a
# dependency for Ansible when selinux is enabled.
- name: Ensure selinux Python package is linked into the virtualenv
file:
src: "/usr/lib64/python2.7/site-packages/selinux"
dest: "{{ kolla_ansible_venv }}/lib/python2.7/site-packages/selinux"
state: link
when:
- ansible_os_family == 'RedHat'
- ansible_selinux != False
- ansible_selinux.status != 'disabled'