Execution
Date 13 May 2024 10:33:23 +0100
Duration None
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
0 Hosts
0 Tasks
0 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
      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
        - ipv6_check.stdout_lines | length > 1