a30ac7de48
Ansible lint has become more fussy about its nit picking, blocking CI. This change makes it happy again. Change-Id: Ifb86c5e071697acda014bb543cab7ebf2b648dc9
67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
---
|
|
- name: Gather os specific variables
|
|
include_vars: "{{ item }}"
|
|
with_first_found:
|
|
- files:
|
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
|
|
- "{{ ansible_distribution }}.yml"
|
|
- "{{ ansible_os_family }}.yml"
|
|
skip: true
|
|
tags: vars
|
|
|
|
- name: Ensure general system requirements are installed
|
|
package:
|
|
name: "{{ system_requirements }}"
|
|
register: result
|
|
until: result is success
|
|
retries: 3
|
|
become: true
|
|
# Don't uninstall requirements during teardown since they may already have
|
|
# been present.
|
|
when: cmd != 'teardown'
|
|
|
|
- name: Ensure log directory exists
|
|
file:
|
|
path: "{{ log_directory }}"
|
|
state: directory
|
|
become: true
|
|
# Don't remove log directory during teardown to preserve historical logs.
|
|
when: cmd != 'teardown'
|
|
|
|
- name: Check if ovs-vsctl command is present
|
|
command: ovs-vsctl --version
|
|
register: ovs_vsctl_check
|
|
failed_when: false
|
|
changed_when: false
|
|
|
|
- block:
|
|
- name: Ensure Open vSwitch package is installed
|
|
package:
|
|
name: "{{ tenks_openvswitch_pkg_name }}"
|
|
register: result
|
|
until: result is success
|
|
retries: 3
|
|
become: true
|
|
|
|
- name: Ensure Open vSwitch is started and enabled
|
|
service:
|
|
name: "{{ tenks_openvswitch_service_name }}"
|
|
state: started
|
|
enabled: true
|
|
become: true
|
|
# Assume a non-zero return code means the command does not exist. Do this
|
|
# check to avoid installing Open vSwitch system-wide if the command already
|
|
# exists as a link to a containerised version of OVS.
|
|
when: ovs_vsctl_check.rc != 0
|
|
|
|
- name: Configure physical networks
|
|
include_tasks: physical_network.yml
|
|
vars:
|
|
network_name: "{{ pn.key }}"
|
|
tenks_bridge: "{{ bridge_prefix ~ (pn.key | physnet_name_to_index) }}"
|
|
source_interface: "{{ pn.value }}"
|
|
state: "{{ 'absent' if cmd == 'teardown' else 'present' }}"
|
|
loop: "{{ query('dict', physnet_mappings) }}"
|
|
loop_control:
|
|
loop_var: pn
|