|
@@ -158,7 +158,7 @@
|
|
|
mode: '0644'
|
|
|
|
|
|
- name: "Register if we are running baremetal (none), virtualized (kvm) or container (lxc)"
|
|
|
- command: systemd-detect-virt
|
|
|
+ command: systemd-detect-virt --container
|
|
|
register: systemd_detect_virt
|
|
|
|
|
|
# Set vm.swappiness to 1 in /etc/sysctl.conf
|
|
@@ -169,7 +169,7 @@
|
|
|
state: present
|
|
|
reload: yes
|
|
|
sysctl_file: /etc/sysctl.conf
|
|
|
- when: systemd_detect_virt.stdout != "lxc"
|
|
|
+ when: systemd_detect_virt.stdout == "none"
|
|
|
|
|
|
- name: "Set nf_conntrack_max to 131072 in sysctl.conf, suitable for max 4gb of ram, conntrack_max = RAMSIZE (in bytes)/16384/2 = 4*1024*1024*1024/16384/2 = 4*32768 = 131072"
|
|
|
sysctl:
|
|
@@ -179,7 +179,7 @@
|
|
|
reload: yes
|
|
|
sysctl_file: /etc/sysctl.conf
|
|
|
#source: https://support.huaweicloud.com/intl/en-us/trouble-ecs/ecs_trouble_0324.html
|
|
|
- when: systemd_detect_virt.stdout != "lxc"
|
|
|
+ when: systemd_detect_virt.stdout == "none"
|
|
|
|
|
|
- name: Disable IPv6 with sysctl
|
|
|
sysctl: name={{ item }} value=1 state=present reload=yes
|
|
@@ -187,7 +187,7 @@
|
|
|
- net.ipv6.conf.all.disable_ipv6
|
|
|
- net.ipv6.conf.default.disable_ipv6
|
|
|
- net.ipv6.conf.lo.disable_ipv6
|
|
|
- when: systemd_detect_virt.stdout != "lxc"
|
|
|
+ when: systemd_detect_virt.stdout == "none"
|
|
|
|
|
|
- ansible.builtin.include_role:
|
|
|
name: ssh_hardening
|