From 9301e82d7bd56e214e406319ee75db42b03a5167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Kr=C4=8Dek?= Date: Mon, 15 Jan 2024 15:19:42 +0100 Subject: [PATCH] Add conditionals for IPv6 sysctl settings This way the playbooks won't try to set ipv6 systemctl options unless ipv6 is available on the system. Closes-bug: #1906306 Change-Id: Icccfc1c509179c3cfd59650b7917a637f9af9646 --- ansible/roles/loadbalancer/tasks/config-host.yml | 7 +++++++ ansible/roles/neutron/tasks/config-host.yml | 6 ++++++ releasenotes/notes/bug-1906306-640d5085576656f9.yaml | 8 ++++++++ 3 files changed, 21 insertions(+) create mode 100644 releasenotes/notes/bug-1906306-640d5085576656f9.yaml diff --git a/ansible/roles/loadbalancer/tasks/config-host.yml b/ansible/roles/loadbalancer/tasks/config-host.yml index 46b262c7a4..c05a8bc3cd 100644 --- a/ansible/roles/loadbalancer/tasks/config-host.yml +++ b/ansible/roles/loadbalancer/tasks/config-host.yml @@ -1,4 +1,10 @@ --- + +- name: Check IPv6 support + command: /usr/sbin/sysctl -n net.ipv6.conf.all.disable_ipv6 + register: ipv6_disabled + changed_when: false + - name: Setting sysctl values vars: should_set: "{{ item.value != 'KOLLA_UNSET' }}" @@ -17,6 +23,7 @@ when: - set_sysctl | bool - item.value != 'KOLLA_SKIP' + - not ('ipv6' in item.name and ipv6_disabled.stdout | bool) - name: Load and persist keepalived module import_role: diff --git a/ansible/roles/neutron/tasks/config-host.yml b/ansible/roles/neutron/tasks/config-host.yml index 9839955de6..112f231f97 100644 --- a/ansible/roles/neutron/tasks/config-host.yml +++ b/ansible/roles/neutron/tasks/config-host.yml @@ -12,6 +12,11 @@ list | length > 0 +- name: Check IPv6 support + command: /usr/sbin/sysctl -n net.ipv6.conf.all.disable_ipv6 + register: ipv6_disabled + changed_when: false + - name: Setting sysctl values become: true vars: @@ -34,3 +39,4 @@ - set_sysctl | bool - item.value != 'KOLLA_SKIP' - (neutron_l3_agent.enabled | bool and neutron_l3_agent.host_in_groups | bool) + - not ('ipv6' in item.name and ipv6_disabled.stdout | bool) diff --git a/releasenotes/notes/bug-1906306-640d5085576656f9.yaml b/releasenotes/notes/bug-1906306-640d5085576656f9.yaml new file mode 100644 index 0000000000..dafb761401 --- /dev/null +++ b/releasenotes/notes/bug-1906306-640d5085576656f9.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Add conditionals for IPv6 sysctl settings + that have IPV6 disabled in kernel. + Changing sysctl settings related to IPv6 on those + systems lead to errors. + `LP#1906306 `__