WIP: Automation for configuring multivm networking #3
@ -13,3 +13,17 @@
|
||||
# range "end" parameter is exclusive, so add 1
|
||||
loop: "{{ range(1, (openqa_worker_count | int + 1)) | list }}"
|
||||
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 }}"
|
||||
|
@ -12,46 +12,25 @@
|
||||
pkg:
|
||||
- os-autoinst-openvswitch
|
||||
- tunctl
|
||||
- network-scripts
|
||||
|
||||
- name: Create /etc/sysconfig/os-autoinst-openvswitch
|
||||
ansible.builtin.copy:
|
||||
src: etc/sysconfig/os-autoinst-openvswitch.j2
|
||||
dest: /etc/sysconfig/os-autoinst-openvswitch
|
||||
mode: '0644'
|
||||
content: |
|
||||
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
|
||||
notify: Restart os-autoinst-openvswitch
|
||||
|
||||
- name: Create bridge interface configuration
|
||||
ansible.builtin.copy:
|
||||
src: etc/sysconfig/network-scripts/ifcfg-br.j2
|
||||
dest: /etc/sysconfig/network-scripts/ifcfg-{{ openqa_multivm_bridge_interface }}
|
||||
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
|
||||
ansible.builtin.copy:
|
||||
src: etc/sysconfig/network-scripts/ifcfg-tap.j2
|
||||
dest: /etc/sysconfig/network-scripts/ifcfg-tap{{ item }}
|
||||
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 }}"
|
||||
|
||||
- name: Update /sbin/ifup-pre-local
|
||||
@ -66,7 +45,7 @@
|
||||
interface: '{{ openqa_multivm_bridge_interface }}'
|
||||
state: enabled
|
||||
zone: internal
|
||||
notify: reload_firewalld
|
||||
notify: Reload firewalld
|
||||
|
||||
- name: Enable masquerade for public and internal zones
|
||||
ansible.posix.firewalld:
|
||||
@ -77,7 +56,7 @@
|
||||
loop:
|
||||
- public
|
||||
- internal
|
||||
notify: reload_firewalld
|
||||
notify: Reload firewalld
|
||||
|
||||
- name: Enable ipv4 IP forwarding
|
||||
ansible.posix.sysctl:
|
||||
@ -93,7 +72,7 @@
|
||||
state: present
|
||||
zone: public
|
||||
target: ACCEPT
|
||||
notify: reload_firewalld
|
||||
notify: Reload firewalld
|
||||
|
||||
# Only needed for multi-host setups
|
||||
- name: Add port for GRE tunnel
|
||||
@ -109,7 +88,6 @@
|
||||
enabled: true
|
||||
loop:
|
||||
- openvswitch
|
||||
- network
|
||||
- os-autoinst-openvswitch
|
||||
ignore_errors: "{{ ansible_check_mode }}"
|
||||
|
||||
@ -121,7 +99,7 @@
|
||||
value: qemu_x86_64,tap
|
||||
state: present
|
||||
mode: '0644'
|
||||
notify: restart_openqa_services
|
||||
notify: Restart openqa services
|
||||
|
||||
- name: Enable bridge interface for openvswitch
|
||||
ansible.builtin.command: ovs-vsctl add-br {{ openqa_multivm_bridge_interface }}
|
||||
|
Loading…
Reference in New Issue
Block a user