From e62cc69d68dc693c5d01b6723750a4b8b4e39a68 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 8 Jul 2025 10:51:55 -0400 Subject: [PATCH] New stuff --- ipv6_disable.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 ipv6_disable.yml diff --git a/ipv6_disable.yml b/ipv6_disable.yml new file mode 100644 index 0000000..de1fde6 --- /dev/null +++ b/ipv6_disable.yml @@ -0,0 +1,32 @@ +--- +- name: IPv6 Check + hosts: test + gather_facts: true + + tasks: + - name: Check host + ansible.builtin.debug: + var: ansible_hostname + + - name: Check for IPv6 configuration + ansible.builtin.shell: + cmd: grep -i ipv6 /etc/sysconfig/network-scripts/ifcfg-* + failed_when: false + changed_when: false + register: ipv6_interfaces + + - name: Debug ipv6_interfaces + ansible.builtin.debug: + var: ipv6_interfaces + when: + - ipv6_interfaces['stdout_lines'] is defined + - ipv6_interfaces['stdout_lines'] | length > 0 + + - name: Disable IPv6 via sysctl + ansible.builtin.lineinfile: + create: true + path: /etc/sysctl.d/42-ipv6-disable + line: "net.ipv6.conf.all.disable_ipv6 = 1" + owner: root + group: root + mode: '0644'