* Write sysctl config to separate file Write our sysctl config to separate file, since newer distributions no longer use the global /etc/sysctl.conf file. All older distributions seem to already support reading from /etc/sysctl.d so this should be no breaking change.
50 lines
1.6 KiB
YAML
50 lines
1.6 KiB
YAML
---
|
|
- name: Set Daemon umask, do config for rhel-family | NSA 2.2.4.1
|
|
ansible.builtin.template:
|
|
src: etc/sysconfig/rhel_sysconfig_init.j2
|
|
dest: /etc/sysconfig/init
|
|
owner: root
|
|
group: root
|
|
mode: "0544"
|
|
when: ansible_facts.os_family == 'RedHat'
|
|
|
|
- name: Change sysctls
|
|
when: ansible_virtualization_type not in ['docker', 'lxc', 'openvz']
|
|
block:
|
|
- name: Protect sysctl.conf
|
|
ansible.builtin.file:
|
|
path: /etc/sysctl.d/90-dev-sec.conf
|
|
owner: root
|
|
group: root
|
|
mode: "0440"
|
|
state: touch
|
|
modification_time: preserve
|
|
access_time: preserve
|
|
|
|
- name: Change various sysctl-settings, look at the sysctl-vars file for documentation
|
|
ansible.posix.sysctl:
|
|
name: "{{ item.key }}"
|
|
value: "{{ item.value }}"
|
|
sysctl_set: true
|
|
sysctl_file: /etc/sysctl.d/90-dev-sec.conf
|
|
state: present
|
|
reload: true
|
|
ignoreerrors: true
|
|
# sysctl_rhel_config is kept for backwards-compatibility. use sysctl_custom_config instead
|
|
# combines all sysctl-dicts into one, adds empty dicts if they are not defined
|
|
with_dict: "{{ ((sysctl_config
|
|
| combine(sysctl_custom_config | default({})))
|
|
| combine(sysctl_rhel_config | default({})))
|
|
| combine(sysctl_overwrite | default({})) }}"
|
|
when: item.key not in sysctl_unsupported_entries | default()
|
|
|
|
- name: Apply ufw defaults
|
|
ansible.builtin.template:
|
|
src: etc/default/ufw.j2
|
|
dest: /etc/default/ufw
|
|
mode: "0644"
|
|
when:
|
|
- ufw_manage_defaults
|
|
- ansible_facts.os_family == 'Debian'
|
|
tags: ufw
|