|
21 | 21 | - name: Change sysctls
|
22 | 22 | when: ansible_virtualization_type not in ['docker', 'lxc', 'openvz']
|
23 | 23 | block:
|
24 |
| - - name: Create a combined sysctl-dict if os-dependent sysctls are defined |
25 |
| - ansible.builtin.set_fact: |
26 |
| - sysctl_config: "{{ sysctl_config | combine(sysctl_custom_config) }}" |
27 |
| - when: sysctl_custom_config | default() |
28 |
| - |
29 |
| - # sysctl_rhel_config is kept for backwards-compatibility. use sysctl_custom_config instead |
30 |
| - - name: Create a combined sysctl-dict if os-dependent sysctls are defined |
31 |
| - ansible.builtin.set_fact: |
32 |
| - sysctl_config: "{{ sysctl_config | combine(sysctl_rhel_config) }}" |
33 |
| - when: sysctl_rhel_config | default() |
34 |
| - |
35 |
| - - name: Create a combined sysctl-dict if overwrites are defined |
36 |
| - ansible.builtin.set_fact: |
37 |
| - sysctl_config: "{{ sysctl_config | combine(sysctl_overwrite) }}" |
38 |
| - when: sysctl_overwrite | default() |
39 |
| - |
40 | 24 | - name: Change various sysctl-settings, look at the sysctl-vars file for documentation
|
41 | 25 | ansible.posix.sysctl:
|
42 | 26 | name: "{{ item.key }}"
|
|
45 | 29 | state: present
|
46 | 30 | reload: true
|
47 | 31 | ignoreerrors: true
|
48 |
| - with_dict: "{{ sysctl_config }}" |
| 32 | + # sysctl_rhel_config is kept for backwards-compatibility. use sysctl_custom_config instead |
| 33 | + # combines all sysctl-dicts into one, adds empty dicts if they are not defined |
| 34 | + with_dict: "{{ ((sysctl_config |
| 35 | + | combine(sysctl_custom_config | default({}))) |
| 36 | + | combine(sysctl_rhel_config | default({}))) |
| 37 | + | combine(sysctl_overwrite | default({})) }}" |
49 | 38 | when: item.key not in sysctl_unsupported_entries | default()
|
50 | 39 |
|
51 | 40 | - name: Apply ufw defaults
|
|
0 commit comments