Files
ansible/roles/ipv4_only/tasks/main.yml
T

33 lines
738 B
YAML
Raw Normal View History

2026-09-16 01:18:39 -04:00
# code: language=ansible
- name: Disable ipv6 (all)
ansible.posix.sysctl:
name: "{{ item }}"
reload: true
state: present
sysctl_set: true
value: 1
loop:
- net.ipv6.conf.all.disable_ipv6
- net.ipv6.conf.default.disable_ipv6
- net.ipv6.conf.lo.disable_ipv6
notify:
- Reboot
- name: Remove IPv6 localhost entries from /etc/hosts
when:
- (ipv4_only | default(false))
ansible.builtin.lineinfile:
path: /etc/hosts
line: "{{ item }}"
state: absent
loop:
- '::1 localhost ip6-localhost ip6-loopback'
- 'ff02::1 ip6-allnodes'
- 'ff02::2 ip6-allrouters'
notify:
- Reboot
- name: Flush handlers to trigger reboot if required
ansible.builtin.meta: flush_handlers