Merge "Allow to skip and unset sysctl vars"

This commit is contained in:
Zuul 2020-10-08 10:21:31 +00:00 committed by Gerrit Code Review
commit 6c5e9321e4
7 changed files with 33 additions and 8 deletions

View File

@ -1,13 +1,17 @@
--- ---
- name: Setting sysctl values - name: Setting sysctl values
become: true become: true
vars:
should_set: "{{ item.value != 'KOLLA_UNSET' }}"
sysctl: sysctl:
name: "{{ item.name }}" name: "{{ item.name }}"
value: "{{ item.value }}" state: "{{ should_set | ternary('present', 'absent') }}"
sysctl_set: yes value: "{{ should_set | ternary(item.value, omit) }}"
sysctl_set: "{{ should_set }}"
sysctl_file: "{{ kolla_sysctl_conf_path }}" sysctl_file: "{{ kolla_sysctl_conf_path }}"
with_items: with_items:
- { name: "vm.max_map_count", value: 262144} - { name: "vm.max_map_count", value: 262144}
when: when:
- set_sysctl | bool - set_sysctl | bool
- item.value != 'KOLLA_SKIP'
- inventory_hostname in groups['elasticsearch'] - inventory_hostname in groups['elasticsearch']

View File

@ -1,9 +1,12 @@
--- ---
- name: Setting sysctl values - name: Setting sysctl values
vars:
should_set: "{{ item.value != 'KOLLA_UNSET' }}"
sysctl: sysctl:
name: "{{ item.name }}" name: "{{ item.name }}"
value: "{{ item.value }}" state: "{{ should_set | ternary('present', 'absent') }}"
sysctl_set: yes value: "{{ should_set | ternary(item.value, omit) }}"
sysctl_set: "{{ should_set }}"
sysctl_file: "{{ kolla_sysctl_conf_path }}" sysctl_file: "{{ kolla_sysctl_conf_path }}"
become: true become: true
with_items: with_items:
@ -12,6 +15,7 @@
- { name: "net.unix.max_dgram_qlen", value: 128} - { name: "net.unix.max_dgram_qlen", value: 128}
when: when:
- set_sysctl | bool - set_sysctl | bool
- item.value != 'KOLLA_SKIP'
- name: Load and persist keepalived module - name: Load and persist keepalived module
import_role: import_role:

View File

@ -486,6 +486,8 @@ neutron_logging_debug: "{{ openstack_logging_debug }}"
openstack_neutron_auth: "{{ openstack_auth }}" openstack_neutron_auth: "{{ openstack_auth }}"
# Set to KOLLA_SKIP to skip setting these (even if set already - total ignore).
# Set to KOLLA_UNSET to make Kolla unset these in the managed sysctl.conf file.
neutron_l3_agent_host_rp_filter_mode: 0 neutron_l3_agent_host_rp_filter_mode: 0
neutron_l3_agent_host_ipv4_neigh_gc_thresh1: 128 neutron_l3_agent_host_ipv4_neigh_gc_thresh1: 128
neutron_l3_agent_host_ipv4_neigh_gc_thresh2: 28672 neutron_l3_agent_host_ipv4_neigh_gc_thresh2: 28672

View File

@ -17,10 +17,12 @@
become: true become: true
vars: vars:
neutron_l3_agent: "{{ neutron_services['neutron-l3-agent'] }}" neutron_l3_agent: "{{ neutron_services['neutron-l3-agent'] }}"
should_set: "{{ item.value != 'KOLLA_UNSET' }}"
sysctl: sysctl:
name: "{{ item.name }}" name: "{{ item.name }}"
value: "{{ item.value }}" state: "{{ should_set | ternary('present', 'absent') }}"
sysctl_set: yes value: "{{ should_set | ternary(item.value, omit) }}"
sysctl_set: "{{ should_set }}"
sysctl_file: "{{ kolla_sysctl_conf_path }}" sysctl_file: "{{ kolla_sysctl_conf_path }}"
with_items: with_items:
- { name: "net.ipv4.ip_forward", value: 1} - { name: "net.ipv4.ip_forward", value: 1}
@ -34,4 +36,5 @@
- { name: "net.ipv6.neigh.default.gc_thresh3", value: "{{ neutron_l3_agent_host_ipv6_neigh_gc_thresh3 }}"} - { name: "net.ipv6.neigh.default.gc_thresh3", value: "{{ neutron_l3_agent_host_ipv6_neigh_gc_thresh3 }}"}
when: when:
- set_sysctl | bool - set_sysctl | bool
- item.value != 'KOLLA_SKIP'
- (neutron_l3_agent.enabled | bool and neutron_l3_agent.host_in_groups | bool) - (neutron_l3_agent.enabled | bool and neutron_l3_agent.host_in_groups | bool)

View File

@ -418,7 +418,10 @@ nova_logging_debug: "{{ openstack_logging_debug }}"
openstack_nova_auth: "{{ openstack_auth }}" openstack_nova_auth: "{{ openstack_auth }}"
# Set to KOLLA_SKIP to skip setting these (even if set already - total ignore).
# Set to KOLLA_UNSET to make Kolla unset these in the managed sysctl.conf file.
nova_compute_host_rp_filter_mode: 0 nova_compute_host_rp_filter_mode: 0
nova_safety_upgrade: "no" nova_safety_upgrade: "no"
nova_libvirt_port: "{{'16514' if libvirt_tls | bool else '16509'}}" nova_libvirt_port: "{{'16514' if libvirt_tls | bool else '16509'}}"

View File

@ -10,10 +10,13 @@
- name: Setting sysctl values - name: Setting sysctl values
become: true become: true
vars:
should_set: "{{ item.value != 'KOLLA_UNSET' }}"
sysctl: sysctl:
name: "{{ item.name }}" name: "{{ item.name }}"
value: "{{ item.value }}" state: "{{ should_set | ternary('present', 'absent') }}"
sysctl_set: yes value: "{{ should_set | ternary(item.value, omit) }}"
sysctl_set: "{{ should_set }}"
sysctl_file: "{{ kolla_sysctl_conf_path }}" sysctl_file: "{{ kolla_sysctl_conf_path }}"
with_items: with_items:
- { name: "net.bridge.bridge-nf-call-iptables", value: 1} - { name: "net.bridge.bridge-nf-call-iptables", value: 1}
@ -22,6 +25,7 @@
- { name: "net.ipv4.conf.default.rp_filter", value: "{{ nova_compute_host_rp_filter_mode }}"} - { name: "net.ipv4.conf.default.rp_filter", value: "{{ nova_compute_host_rp_filter_mode }}"}
when: when:
- set_sysctl | bool - set_sysctl | bool
- item.value != 'KOLLA_SKIP'
- inventory_hostname in groups[nova_cell_compute_group] - inventory_hostname in groups[nova_cell_compute_group]
# NOTE(yoctozepto): Part of bug #1681461 fix. # NOTE(yoctozepto): Part of bug #1681461 fix.

View File

@ -0,0 +1,5 @@
---
features:
- |
Allows to skip and unset sysctl variables controlled by Kolla Ansible
plays using ``KOLLA_SKIP`` and ``KOLLA_UNSET`` values.