- name: setup ipv6 gather_facts: no hosts: "{{target}}" become: "{{ become_var | default(false) }}" tasks: - name: workstation has ip6 delegate_to: localhost run_once: true become: true shell: executable: /bin/bash cmd: | set -e if [[ {{ansible_check_mode}} = True ]]; then ifconfig kvmbr0 | grep inet6 | grep -v fe80 || echo WILL ADD IP6 DURING PLAY else ifconfig kvmbr0 | grep inet6 | grep -v fe80 || ip addr add baaf::baaf:1/112 dev kvmbr0 && echo done fi changed_when: false check_mode: false register: output - debug: var=output.stdout - debug: var=type run_once: true - name: interfaces copy: src: "interfaces.{{type}}.{{inventory_hostname_short}}" dest: /etc/network/interfaces notify: reboot required - name: sysctl.conf (natgw) copy: src: sysctl.conf dest: /etc/sysctl.conf when: natgw is defined notify: reload kernel parms - name: nftables.conf (natgw) copy: src: "nftables.{{type}}.conf" dest: /etc/nftables.conf when: natgw is defined notify: load nftables - name: nftables up and enabled (natgw) systemd: name: nftables state: started enabled: true when: natgw is defined - name: workstation reaches ip6 network within delegate_to: localhost run_once: true become: true shell: executable: /bin/bash cmd: | set -e if [[ {{ansible_check_mode}} = True ]]; then netstat -6rn | grep ^beef::beef || echo WILL ADD ROUTE DURING PLAY else netstat -6rn | grep ^beef::beef || ip route add beef::beef:0/122 via baaf::baaf:21 && echo done fi changed_when: false check_mode: false register: output when: type == 'nat4400' - debug: var=output.stdout when: type == 'nat4400' handlers: - name: reboot required debug: msg="reboot required debug exit {{0/0}}" - name: reload kernel parms command: sysctl -p - name: load nftables command: nft -f /etc/nftables.conf