Place sysctl options to it's own file

Instead of defining all kernel options in sysctl.conf, which has highest
precedence, use a standalone sysctl file with high enough prescendence,
but still overridable with any other custom config files.

Closes-Bug: #1748951
Change-Id: I52ff941f2187e7c090c836ea4b504726b232bd33
This commit is contained in:
Dmitriy Rabotyagov 2024-02-13 16:56:18 +01:00 committed by Dmitriy Rabotyagov
parent f5b386f3d4
commit 0d746da95e
3 changed files with 27 additions and 0 deletions

View File

@ -138,6 +138,8 @@ openstack_kernel_options:
# above.
openstack_user_kernel_options: []
openstack_sysctl_file: /etc/sysctl.d/70-openstack-ansible.conf
# User defined list of extra packages to install on all hosts and containers
openstack_host_extra_distro_packages: []

View File

@ -0,0 +1,12 @@
---
features:
- |
Implemented new variable ``openstack_sysctl_file`` that will control
location of sysctl config file. Defaults to ``/etc/sysctl.d/70-openstack-ansible.conf``
upgrade:
- |
During upgrade sysctl options managed by ``openstack_user_kernel_options``
and ``openstack_kernel_options`` will be moved from /etc/sysctl.conf to
``/etc/sysctl.d/70-openstack-ansible.conf`` by default. You can control
location with ``openstack_sysctl_file``. In order to use prior location
you can define ``openstack_sysctl_file: /etc/sysctl.conf``

View File

@ -76,11 +76,24 @@
name: "{{ item.key }}"
value: "{{ item.value }}"
sysctl_set: "{{ item.set | default('yes') }}"
sysctl_file: "{{ openstack_sysctl_file }}"
state: "{{ item.state | default('present') }}"
reload: no
with_items: "{{ openstack_kernel_options + openstack_user_kernel_options }}"
failed_when: false
# TODO(noonedeadpunk): Remove that after 2024.1 release.
- name: Remove system tunning from common file
sysctl:
name: "{{ item.key }}"
value: "{{ item.value }}"
sysctl_set: "{{ item.set | default('yes') }}"
sysctl_file: /etc/sysctl.conf
state: absent
reload: no
with_items: "{{ openstack_kernel_options + openstack_user_kernel_options }}"
failed_when: false
- name: Configure sysstat
include_tasks: openstack_sysstat.yml
when: