You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.8 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. ---
  2. # Todo : selinux configuration
  3. - name: Confirm selinux deployed
  4. stat:
  5. path: /etc/selinux/config
  6. when:
  7. - ansible_os_family == "RedHat"
  8. - "'Amazon' not in ansible_distribution"
  9. register: slc
  10. - name: Set selinux policy
  11. selinux:
  12. policy: targeted
  13. state: "{{ preinstall_selinux_state }}"
  14. when:
  15. - ansible_os_family == "RedHat"
  16. - "'Amazon' not in ansible_distribution"
  17. - slc.stat.exists
  18. changed_when: False
  19. tags:
  20. - bootstrap-os
  21. - name: Disable IPv6 DNS lookup
  22. lineinfile:
  23. dest: /etc/gai.conf
  24. line: "precedence ::ffff:0:0/96 100"
  25. state: present
  26. create: yes
  27. backup: yes
  28. when:
  29. - disable_ipv6_dns
  30. - not ansible_os_family in ["Flatcar Container Linux by Kinvolk"]
  31. tags:
  32. - bootstrap-os
  33. - name: Stat sysctl file configuration
  34. stat:
  35. path: "{{ sysctl_file_path }}"
  36. register: sysctl_file_stat
  37. tags:
  38. - bootstrap-os
  39. - name: Change sysctl file path to link source if linked
  40. set_fact:
  41. sysctl_file_path: "{{ sysctl_file_stat.stat.lnk_source }}"
  42. when:
  43. - sysctl_file_stat.stat.islnk is defined
  44. - sysctl_file_stat.stat.islnk
  45. tags:
  46. - bootstrap-os
  47. - name: Make sure sysctl file path folder exists
  48. file:
  49. name: "{{ sysctl_file_path | dirname }}"
  50. state: directory
  51. - name: Enable ip forwarding
  52. sysctl:
  53. sysctl_file: "{{ sysctl_file_path }}"
  54. name: net.ipv4.ip_forward
  55. value: 1
  56. state: present
  57. reload: yes
  58. - name: Ensure kube-bench parameters are set
  59. sysctl:
  60. sysctl_file: /etc/sysctl.d/bridge-nf-call.conf
  61. name: "{{ item.name }}"
  62. value: "{{ item.value }}"
  63. state: present
  64. reload: yes
  65. with_items:
  66. - { name: vm.overcommit_memory, value: 1 }
  67. - { name: kernel.panic, value: 10 }
  68. - { name: kernel.panic_on_oops, value: 1 }
  69. when: kubelet_protect_kernel_defaults|bool