# Note that Wireguard does DNS resolution only once during connection. # When a client's IP changes, the server should be notified in some way, # using `wg set wg0 peer izHzmRwh2yzICps6pFI2Bg3TnmTD66/8uH4loJpkuD4= endpoint :` # for example. - name: Set hostname become: true ansible.builtin.hostname: name: '{{ hostname }}' use: systemd - name: Copy hosts file become: true ansible.builtin.template: src: templates/hosts.j2 dest: /etc/hosts mode: '0644' owner: root - name: Copy firewall template become: true ansible.builtin.template: src: 'templates/{{ ansible_hostname }}/nftables.j2' dest: /etc/nftables.conf owner: root group: root mode: '0600' notify: restart nftables