9111328e8a
By default, Ansible injects a variable for every fact, prefixed with ansible_. This can result in a large number of variables for each host, which at scale can incur a performance penalty. Ansible provides a configuration option [0] that can be set to False to prevent this injection of facts. In this case, facts should be referenced via ansible_facts.<fact>. This change updates all references to Ansible facts within Tenks from using individual fact variables to using the items in the ansible_facts dictionary. This allows users to disable fact variable injection in their Ansible configuration, which may provide some performance improvement. This change disables fact variable injection in the ansible configuration used in CI, to catch any attempts to use the injected variables. [0] https://docs.ansible.com/ansible/latest/reference_appendices/config.html#inject-facts-as-vars Change-Id: I4831769909c341c72bb178daf8df3309773a56ad Co-Authored-By: Radosław Piliszek <radoslaw.piliszek@gmail.com>
73 lines
2.2 KiB
YAML
73 lines
2.2 KiB
YAML
---
|
|
- hosts: hypervisors
|
|
vars:
|
|
ansible_become: true
|
|
tasks:
|
|
# Workaround for:
|
|
# http://mirror.ord.rax.opendev.org/epel/7/SRPMS/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
|
|
# See: https://zuul.opendev.org/t/openstack/build/1fa5b2f895c54e7a81a064a2fff5f838/log/centos-7/ansible/tenks-deploy#501
|
|
- block:
|
|
- name: Install epel release
|
|
package:
|
|
name: epel-release
|
|
|
|
- name: Switch the broken mirror
|
|
ini_file:
|
|
path: /etc/yum.repos.d/epel.repo
|
|
section: epel-source
|
|
option: baseurl
|
|
value: http://download.fedoraproject.org/pub/epel/$releasever/SRPMS/
|
|
|
|
- name: Make sure metalink does not exist
|
|
ini_file:
|
|
path: /etc/yum.repos.d/epel.repo
|
|
section: epel-source
|
|
option: metalink
|
|
state: absent
|
|
|
|
- name: Install Open vSwitch
|
|
include_role:
|
|
name: fkautz.openvswitch-install
|
|
when:
|
|
- ansible_facts.os_family == "RedHat"
|
|
- ansible_facts.distribution_major_version is version(8, '<')
|
|
|
|
- block:
|
|
- name: Install the Delorean repositories
|
|
get_url:
|
|
url: "{{ item }}"
|
|
dest: /etc/yum.repos.d/
|
|
with_items:
|
|
- https://trunk.rdoproject.org/centos8-master/consistent/delorean.repo
|
|
- https://trunk.rdoproject.org/centos8-master/delorean-deps.repo
|
|
|
|
- name: Install Open vSwitch
|
|
package:
|
|
name: openvswitch
|
|
|
|
- name: Start openvswitch service
|
|
service:
|
|
name: openvswitch
|
|
state: started
|
|
when:
|
|
- ansible_facts.os_family == "RedHat"
|
|
- ansible_facts.distribution_major_version is version(8, '>=')
|
|
|
|
- block:
|
|
- name: Install packages
|
|
package:
|
|
name: "{{ item }}"
|
|
register: result
|
|
until: result is success
|
|
retries: 3
|
|
with_items:
|
|
- openvswitch-switch
|
|
- openvswitch-common
|
|
|
|
- name: Start openvswitch service
|
|
service:
|
|
name: openvswitch-switch
|
|
state: started
|
|
when: ansible_facts.os_family == "Debian"
|
|
|