e9e1535646
Change-Id: If7a1070da62fb1d1aec5c5c530e0af174e3c3cf8
113 lines
3.4 KiB
YAML
113 lines
3.4 KiB
YAML
# If ansible_install_version is not defined it should be "latest"
|
|
- name: Set ansible default version to latest
|
|
set_fact:
|
|
install_ansible_version: latest
|
|
when: install_ansible_version is not defined
|
|
|
|
# If a version is not explicitly set we want to make sure to
|
|
# completely omit the version argument to pip, as it will be coming
|
|
# from the long-form install_ansible_name variable. Additionally, if
|
|
# the version is the special value "latest", then we also want to omit
|
|
# any version number, but also set the package state to "latest".
|
|
- name: Set ansible version for installation
|
|
set_fact:
|
|
_install_ansible_version: '{{ install_ansible_version }}'
|
|
when: install_ansible_version not in ('', 'latest')
|
|
|
|
- name: Set ansible package state for installation
|
|
set_fact:
|
|
_install_ansible_state: latest
|
|
when: install_ansible_version == 'latest'
|
|
|
|
- name: Install ansible
|
|
pip:
|
|
name: '{{ install_ansible_name | default("ansible") }}'
|
|
version: '{{ _install_ansible_version | default(omit) }}'
|
|
state: '{{ _install_ansible_state | default(omit) }}'
|
|
|
|
# For use by k8s_raw ansible module
|
|
# - name: Install openshift client
|
|
# pip:
|
|
# name: 'openshift'
|
|
# TODO(corvus): re-add this once kubernetes 9.0.0 is released
|
|
|
|
# Same version/state default swizzling as described above for
|
|
# openstacksdk
|
|
- name: Set openstacksdk default version to latest
|
|
set_fact:
|
|
install_ansible_openstacksdk_version: latest
|
|
when: install_ansible_openstacksdk_version is not defined
|
|
|
|
- name: Set openstacksdk version for installation
|
|
set_fact:
|
|
_install_ansible_openstacksdk_version: '{{ install_ansible_openstacksdk_version }}'
|
|
when: install_ansible_openstacksdk_version not in ('', 'latest')
|
|
|
|
- name: Set openstacksdk package state for installation
|
|
set_fact:
|
|
_install_openstacksdk_state: latest
|
|
when: install_ansible_openstacksdk_version == 'latest'
|
|
|
|
- name: Install openstacksdk
|
|
pip:
|
|
name: '{{ install_ansible_openstacksdk_name | default("openstacksdk") }}'
|
|
version: '{{ _install_ansible_openstacksdk_version | default(omit) }}'
|
|
state: '{{ _install_openstacksdk_state | default(omit) }}'
|
|
|
|
- name: Ensure /etc/ansible and /etc/ansible/hosts
|
|
file:
|
|
state: directory
|
|
path: /etc/ansible/hosts
|
|
|
|
- name: Ensure /etc/ansible/inventory_plugins
|
|
file:
|
|
state: directory
|
|
path: /etc/ansible/inventory_plugins
|
|
|
|
- name: Ensure /var/cache/ansible
|
|
file:
|
|
state: directory
|
|
path: /var/cache/ansible
|
|
owner: root
|
|
group: root
|
|
mode: 0770
|
|
|
|
- name: Ensure ansible log dir is writable
|
|
file:
|
|
path: /var/log/ansible
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: 0775
|
|
|
|
- name: Set up the ARA callback
|
|
include_tasks: install_ara.yaml
|
|
when: install_ansible_ara_enable
|
|
|
|
- name: Copy ansible.cfg in to place
|
|
template:
|
|
src: ansible.cfg.j2
|
|
dest: /etc/ansible/ansible.cfg
|
|
|
|
# NOTE(mordred) The copy of the openstack inventory plugin from 2.6 is busted.
|
|
# It doesn't proerly deal with caching. A fix has been submitted upstream, but
|
|
# for now this is a fixed copy.
|
|
- name: Copy fixed openstack inventory in place
|
|
copy:
|
|
src: inventory_plugins/openstack.py
|
|
dest: /etc/ansible/inventory_plugins/openstack.py
|
|
|
|
- name: Copy yamlgroup inventory in place
|
|
copy:
|
|
src: inventory_plugins/yamlgroup.py
|
|
dest: /etc/ansible/inventory_plugins/yamlgroup.py
|
|
|
|
- name: Setup log rotation
|
|
include_role:
|
|
name: logrotate
|
|
vars:
|
|
logrotate_file_name: /var/log/ansible/ansible.log
|
|
|
|
- name: Verify ansible install
|
|
command: ansible --version
|