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.

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