--- - name: Install wireguard hosts: "{{ my_hosts | d([]) }}" become: true tasks: - name: Install wireguard ansible.builtin.apt: name: wireguard update_cache: true - name: Generate private and public keypair ansible.builtin.shell: | wg genkey | tee privatekey | wg pubkey > publickey chmod 0400 privatekey chmod 0400 publickey