WIP: Automation for configuring multivm networking #3

Closed
raktajino wants to merge 5 commits from multivm_networking into worker_host
2 changed files with 22 additions and 30 deletions
Showing only changes of commit cb28454abc - Show all commits

View File

@ -13,3 +13,17 @@
# range "end" parameter is exclusive, so add 1 # range "end" parameter is exclusive, so add 1
loop: "{{ range(1, (openqa_worker_count | int + 1)) | list }}" loop: "{{ range(1, (openqa_worker_count | int + 1)) | list }}"
ignore_errors: "{{ ansible_check_mode }}" ignore_errors: "{{ ansible_check_mode }}"
- name: Restart openqa services
ansible.builtin.systemd:
name: "{{ item }}"
state: restarted
loop: "{{ openqa_services }}"
ignore_errors: "{{ ansible_check_mode }}"
- name: Restart os-autoinst-openvswitch
ansible.builtin.systemd:
name: os-autoinst-openvswitch
state: restarted
enabled: true
ignore_errors: "{{ ansible_check_mode }}"

View File

@ -12,46 +12,25 @@
pkg: pkg:
- os-autoinst-openvswitch - os-autoinst-openvswitch
- tunctl - tunctl
- network-scripts
- name: Create /etc/sysconfig/os-autoinst-openvswitch - name: Create /etc/sysconfig/os-autoinst-openvswitch
ansible.builtin.copy: ansible.builtin.copy:
src: etc/sysconfig/os-autoinst-openvswitch.j2
dest: /etc/sysconfig/os-autoinst-openvswitch dest: /etc/sysconfig/os-autoinst-openvswitch
mode: '0644' mode: '0644'
content: | notify: Restart os-autoinst-openvswitch
OS_AUTOINST_BRIDGE_LOCAL_IP=172.16.2.2
OS_AUTOINST_BRIDGE_REWRITE_TARGET=172.17.0.0
OS_AUTOINST_USE_BRIDGE={{ openqa_multivm_bridge_interface }}
notify: restart_os-autoinst-openvswitch
- name: Create bridge interface configuration - name: Create bridge interface configuration
ansible.builtin.copy: ansible.builtin.copy:
src: etc/sysconfig/network-scripts/ifcfg-br.j2
dest: /etc/sysconfig/network-scripts/ifcfg-{{ openqa_multivm_bridge_interface }} dest: /etc/sysconfig/network-scripts/ifcfg-{{ openqa_multivm_bridge_interface }}
mode: '0644' mode: '0644'
content: |
DEVICETYPE='ovs'
TYPE='OVSBridge'
BOOTPROTO='static'
IPADDR='172.16.2.2'
NETMASK='255.254.0.0'
DEVICE={{ openqa_multivm_bridge_interface }}
STP=off
ONBOOT='yes'
NAME='{{ openqa_multivm_bridge_interface }}'
HOTPLUG='no'
- name: Create worker tap interface configs - name: Create worker tap interface configs
ansible.builtin.copy: ansible.builtin.copy:
src: etc/sysconfig/network-scripts/ifcfg-tap.j2
dest: /etc/sysconfig/network-scripts/ifcfg-tap{{ item }} dest: /etc/sysconfig/network-scripts/ifcfg-tap{{ item }}
mode: '0644' mode: '0644'
content: |
DEVICETYPE='ovs'
TYPE='OVSPort'
OVS_BRIDGE='{{ openqa_multivm_bridge_interface }}'
DEVICE='tap{{ item }}'
ONBOOT='yes'
BOOTPROTO='none'
HOTPLUG='no'
loop: "{{ range(openqa_worker_count) | list }}" loop: "{{ range(openqa_worker_count) | list }}"
- name: Update /sbin/ifup-pre-local - name: Update /sbin/ifup-pre-local
@ -66,7 +45,7 @@
interface: '{{ openqa_multivm_bridge_interface }}' interface: '{{ openqa_multivm_bridge_interface }}'
state: enabled state: enabled
zone: internal zone: internal
notify: reload_firewalld notify: Reload firewalld
- name: Enable masquerade for public and internal zones - name: Enable masquerade for public and internal zones
ansible.posix.firewalld: ansible.posix.firewalld:
@ -77,7 +56,7 @@
loop: loop:
- public - public
- internal - internal
notify: reload_firewalld notify: Reload firewalld
- name: Enable ipv4 IP forwarding - name: Enable ipv4 IP forwarding
ansible.posix.sysctl: ansible.posix.sysctl:
@ -93,7 +72,7 @@
state: present state: present
zone: public zone: public
target: ACCEPT target: ACCEPT
notify: reload_firewalld notify: Reload firewalld
# Only needed for multi-host setups # Only needed for multi-host setups
- name: Add port for GRE tunnel - name: Add port for GRE tunnel
@ -109,7 +88,6 @@
enabled: true enabled: true
loop: loop:
- openvswitch - openvswitch
- network
- os-autoinst-openvswitch - os-autoinst-openvswitch
ignore_errors: "{{ ansible_check_mode }}" ignore_errors: "{{ ansible_check_mode }}"
@ -121,7 +99,7 @@
value: qemu_x86_64,tap value: qemu_x86_64,tap
state: present state: present
mode: '0644' mode: '0644'
notify: restart_openqa_services notify: Restart openqa services
- name: Enable bridge interface for openvswitch - name: Enable bridge interface for openvswitch
ansible.builtin.command: ovs-vsctl add-br {{ openqa_multivm_bridge_interface }} ansible.builtin.command: ovs-vsctl add-br {{ openqa_multivm_bridge_interface }}