Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare networking as early as possible #1717

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions roles/devscripts/tasks/133_host_network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,49 +56,6 @@
list
}}
block:
- name: Ensure firewalld is installed
ansible.builtin.package:
name:
- firewalld

- name: Ensure br_netfilter module is loaded.
community.general.modprobe:
name: br_netfilter
state: present

- name: Ensure IP forwarding is enabled.
ansible.posix.sysctl:
name: net.ipv4.ip_forward
value: 1
state: present

- name: Ensure the required parameters are loaded.
ansible.posix.sysctl:
name: "net.bridge.bridge-nf-call-{{ item }}"
value: 0
state: present
loop:
- arptables
- iptables
- ip6tables
loop_control:
label: "{{ item }}"

- name: Ensure firewall service is enabled and started.
ansible.builtin.service:
name: firewalld
enabled: true
state: started

- name: Create the virtual networks.
vars:
cifmw_libvirt_manager_net_prefix_add: false
_cifmw_libvirt_manager_layout:
networks: "{{ cifmw_libvirt_manager_configuration.networks }}"
ansible.builtin.include_role:
name: libvirt_manager
tasks_from: create_networks.yml

- name: Ensure masquerading for external network
become: true
vars:
Expand Down
25 changes: 22 additions & 3 deletions roles/reproducer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@
name: discover_latest_image

- name: Load CI job environment
tags:
- bootstrap_layout
when:
- cifmw_job_uri is defined
ansible.builtin.include_tasks: ci_data.yml

- name: Update libvirt layout
ansible.builtin.import_role:
- name: Build final libvirt layout
when:
- cifmw_use_libvirt | default(false) | bool
ansible.builtin.include_role:
name: "libvirt_manager"
tasks_from: "generate_layout.yml"

Expand All @@ -53,7 +57,7 @@
cifmw_install_ca_url to download from a url or cifmw_install_ca_bundle_src
to use a file present on the host.

- name: Set _use_crc before layout update
- name: Set _use_crc based on actual layout
ansible.builtin.set_fact:
_use_crc: >-
{{
Expand Down Expand Up @@ -85,6 +89,21 @@
tags:
- bootstrap_libvirt

- name: Deploy networks in libvirt
when:
- cifmw_use_libvirt | default(false) | bool
tags:
- bootstrap
- bootstrap_env
- bootstrap_layout
ansible.builtin.include_tasks:
file: prepare_networking.yml
apply:
tags:
- bootstrap
- bootstrap_env
- bootstrap_layout

- name: Deploy CRC if needed
when:
- _use_crc | bool
Expand Down
42 changes: 42 additions & 0 deletions roles/reproducer/tasks/prepare_networking.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
- name: Ensure basic host configurations are present
become: true
block:
- name: Ensure firewalld is installed
ansible.builtin.package:
name:
- firewalld

- name: Ensure br_netfilter module is loaded
community.general.modprobe:
name: br_netfilter
state: present

- name: Ensure IP forwarding is enabled
ansible.posix.sysctl:
name: net.ipv4.ip_forward
value: 1
state: present

- name: Ensure the required parameters are loaded
ansible.posix.sysctl:
name: "net.bridge.bridge-nf-call-{{ item }}"
value: 0
state: present
loop:
- arptables
- iptables
- ip6tables
loop_control:
label: "{{ item }}"

- name: Ensure firewall service is enabled and started
ansible.builtin.service:
name: firewalld
enabled: true
state: started

- name: Create the virtual networks
ansible.builtin.import_role:
name: libvirt_manager
tasks_from: create_networks.yml