Mark Goddard f611fa16b2 Workaround ansible_selinux fact either being a dict or false
If the python SELinux bindings are not importable by ansible, it returns false as
the ansible_selinux fact.
2017-08-07 22:13:06 +00:00

80 lines
2.4 KiB
YAML

---
- name: Ensure EPEL repo is installed
yum:
name: epel-release
state: installed
become: True
- name: Ensure required packages are installed
yum:
name: "{{ item }}"
state: installed
become: True
with_items:
- gcc
- libffi-devel
- openssl-devel
- patch
- python-devel
- python-pip
- python-virtualenv
- name: Ensure source code checkout path exists
file:
path: "{{ source_checkout_path }}"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
recurse: True
become: True
when: "{{ kolla_ctl_install_type == 'source' }}"
- name: Ensure Kolla Ansible source code checkout exists
git:
repo: "{{ kolla_ansible_source_url }}"
dest: "{{ source_checkout_path }}/kolla-ansible"
version: "{{ kolla_ansible_source_version }}"
when: "{{ kolla_ctl_install_type == 'source' }}"
- name: Ensure the latest version of pip is installed
pip:
name: "{{ item.name }}"
state: latest
virtualenv: "{{ kolla_venv }}"
with_items:
- { name: pip }
- name: Ensure required Python packages are installed
pip:
name: "{{ item.name }}"
version: "{{ item.version | default(omit) }}"
state: present
virtualenv: "{{ kolla_venv }}"
with_items:
# Intall Kolla Ansible from source.
- name: "{{ source_checkout_path }}/kolla-ansible"
install: "{{ kolla_ctl_install_type == 'source' }}"
# Intall Kolla Ansible from PyPI.
- name: "kolla-ansible"
version: "{{ kolla_openstack_release }}"
install: "{{ kolla_ctl_install_type == 'binary' }}"
# On CentOS 7.3 Jinja2==2.7, but kolla-ansible requires 2.8. Install
# Ansible to ensure we pull in and use a later Jinja2.
- name: "ansible"
version: "2.2"
# Required for kolla-genpwd.
- name: PyYAML
version: "3.12"
when: "{{ item.install | default(True) | bool }}"
# 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_venv }}/lib/python2.7/site-packages/selinux"
state: link
when: "{{ ansible_selinux.mode|default != 'disabled' }}"