Execution
Date 13 May 2024 10:38:12 +0100
Duration 00:02:56.23
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.4
ara 1.7.1 / 1.7.2.dev2
Python 3.10.10
Summary
479 Hosts
3 Tasks
950 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/ipv6-check.yaml

---
- name: Playbook to check the server for ipv6
  hosts: all
  gather_facts: true
  vars:
    folder: /home/ssh-gateway/ansible/playbook_output
  tasks:
    - name: Check if host has IPv6
      ansible.builtin.command: ip -6 addr show scope global
      register: ipv6_check
      ignore_errors: true
      changed_when: false
    - name: Write hostname to file
      ansible.builtin.lineinfile:
        dest: "{{ folder }}/ipv6-servers.txt"
        line: "{{ ansible_facts.nodename }}"
        create: true
        mode: '0644'
      delegate_to: 127.0.0.1
      when: ipv6_check.rc == 0