# needs to be run with a different user with access to create ansible key and user. # e.g. # ansible-playbook bootstrap.yml -e ansible_ssh_user=cianhatton # might additionally require -K if your user requires password for sudo. - name: Generate SSH Key for ansible hosts: localhost connection: local tasks: - name: Generate an OpenSSH rsa keypair for ansible community.crypto.openssh_keypair: path: ~/.ssh/ansible passphrase: '' - name: Bootstrap Ansible hosts. hosts: all become: true roles: - role: bootstrap