- name: test stateless nat gather_facts: no hosts: "{{target}}" become: "{{ become_var | default(false) }}" tasks: - debug: var=type run_once: true # all nodes - template: src: rc.inet1 dest: /etc/rc.d/rc.inet1 notify: rc.inet1 # only on the nat gateway - template: src: "nftables.{{type}}.conf" dest: /etc/nftables.conf when: natgw is defined notify: load nftables # only on the nat gateway - lineinfile: path: /etc/ssh/sshd_config regexp: ^[pP]ort line: "port 2222" create: true notify: restart sshd when: natgw is defined handlers: - name: load nftables command: nft -f /etc/nftables.conf - name: rc.inet1 command: /etc/rc.d/rc.inet1 - name: restart sshd command: /etc/rc.d/rc.sshd restart