[CI] Optimise ovs setup

Change-Id: I28ec8e02054ea75efffe472672ff3ed46c6f2cf7
This commit is contained in:
Radosław Piliszek 2022-09-09 21:13:38 +00:00
parent 75d5ba7338
commit 6ca0bb7bd6
6 changed files with 40 additions and 51 deletions

View File

@ -1,41 +0,0 @@
---
- hosts: hypervisors
vars:
ansible_become: true
tasks:
- block:
- name: Install the Delorean repositories
get_url:
url: "{{ item }}"
dest: /etc/yum.repos.d/
with_items:
- "https://trunk.rdoproject.org/centos{{ ansible_facts.distribution_major_version }}-master/consistent/delorean.repo"
- "https://trunk.rdoproject.org/centos{{ ansible_facts.distribution_major_version }}-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"
- 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"

View File

@ -6,16 +6,17 @@
- name: Include common variables
include_vars: common.yml
- name: Install Open vSwitch
shell:
cmd: >-
{{ ansible_playbook_bin }} -vvv
--inventory ansible/inventory
--extra-vars=@{{ tenks_overrides_path }}
playbooks/openvswitch.yml > {{ logs_dir }}/ansible/tenks-deploy
chdir: "{{ tenks_src_dir }}"
environment:
ANSIBLE_ROLES_PATH: "{{ tenks_src_dir }}/ansible/roles"
- name: Include OS-specific variables
include_vars: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.distribution }}.yml"
- "{{ ansible_facts.os_family }}.yml"
skip: true
- name: Ensure Open vSwitch is set up
include_tasks: tasks/ensure_openvswitch.yml
when: bridge_type == 'openvswitch'
- name: Deploy tenks cluster

View File

@ -0,0 +1,23 @@
---
- name: Install the Delorean dependencies repository
become: true
get_url:
url: "https://trunk.rdoproject.org/centos{{ ansible_facts.distribution_major_version }}-master/delorean-deps.repo"
dest: /etc/yum.repos.d/
when:
- ansible_facts.os_family == "RedHat"
- name: Install Open vSwitch
become: true
package:
name: "{{ openvswitch_package_name }}"
state: present
register: result
until: result is success
retries: 3
- name: Start Open vSwitch service
become: true
service:
name: "{{ openvswitch_service_name }}"
state: started

View File

@ -0,0 +1,2 @@
---
openvswitch_package_name: openvswitch-switch

View File

@ -0,0 +1,2 @@
---
openvswitch_package_name: openvswitch

View File

@ -13,3 +13,5 @@ config_dir: "{{ ansible_facts.env.HOME ~ '/' ~ 'tenks-config' }}"
tenks_overrides_path: "{{ config_dir ~ '/' ~ 'tenks-overrides.yml' }}"
tenks_requirements_overrides_path: "{{ tenks_src_dir }}/requirements-overrides.yml"
logs_dir: "/tmp/logs"
openvswitch_service_name: "{{ openvswitch_package_name }}"