diff --git a/disable-ipv6.yml b/disable-ipv6.yml new file mode 100644 index 0000000..bde7fe6 --- /dev/null +++ b/disable-ipv6.yml @@ -0,0 +1,37 @@ +--- +- name: disable IPv6 with sysctl + sysctl: name={{ item }} value=1 state=present reload=yes + with_items: + - net.ipv6.conf.all.disable_ipv6 + - net.ipv6.conf.default.disable_ipv6 + - net.ipv6.conf.lo.disable_ipv6 + +#- name: placeholder true for ipv6 in modprobe +# lineinfile: +# dest: /etc/modprobe.conf +# line: 'install ipv6 /bin/true' +# mode: '0644' + +- name: disable ipv6 in sysconfig/network + lineinfile: + dest: /etc/sysconfig/network + regexp: "^{{ item.regexp }}" + line: "{{ item.line }}" + mode: '0644' + backup: yes + create: yes + with_items: + - { regexp: 'NETWORKING_IPV6=.*', line: 'NETWORKING_IPV6=NO' } + - { regexp: 'IPV6INIT=.*', line: 'IPV6INIT=no' } + +- name: unactive ipv6 sshd + lineinfile: + dest: /etc/ssh/sshd_config + insertafter: '^#ListenAddress 0.0.0.0' + line: 'ListenAddress 0.0.0.0' + +- name: disable ipv6 chronyd + replace: + dest: /etc/sysconfig/chronyd + regexp: 'OPTIONS=*' + replace: 'OPTIONS="-4"' \ No newline at end of file diff --git a/main.yml b/main.yml index 38da914..f21f3d1 100644 --- a/main.yml +++ b/main.yml @@ -3,7 +3,7 @@ tasks: - include_tasks: assert-vars.yml -# - include_tasks: disable_ipv6.yml + - include_tasks: disable-ipv6.yml - include_tasks: hosts.yml # - include_tasks: inst_packages.yml # - include_tasks: misc.yml