--- - name: mkdir ~/.ssh connection: local delegate_to: localhost raw: "lxc exec {{ inventory_hostname }} -- mkdir -p /root/.ssh" - name: get authorized_keys connection: local delegate_to: localhost copy: src: authorized_keys dest: "/var/lib/lxd/storage-pools/default/containers/{{ inventory_hostname }}/rootfs/root/.ssh/authorized_keys" owner: root group: root mode: 0600 - name: fix file permissions connection: local delegate_to: localhost raw: "lxc exec {{ inventory_hostname }} -- chmod 0600 /root/.ssh/authorized_keys"