--- - name: install wireguard hosts: "{{ hosts }}" become: yes tasks: - name: install wireguard apt: name: wireguard update_cache: yes - name: generate private and public keypair shell: | wg genkey | tee privatekey | wg pubkey > publickey chmod 0400 privatekey chmod 0400 publickey