Hello everyone,
I'm attempting to deploy my public ssh key (id_rsa.pub) from one server to two other servers. I'm using the the example here
http://docs.ansible.com/ansible/auth...ey_module.html with the following configuration file called sshkeys.yml:
- name: Add Pub key
- hosts: server1,server2
- authorized_key: user=user1 key="{{ lookup('file', '/home/user1/.ssh/id_rsa.pub') }}"
The command I'm running is ansible-playbook sshkeys.yml -u user1 -k and the result I'm getting is this:
"ERROR! 'authorized_key' is not a valid attribute for a Play
The error appears to have been in '/home/user1/playbooks/sshkeys.yml': line 4, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- hosts: server1,server2
- authorized_key: user=user1 key="{{ lookup('file', '/home/user1/.ssh/id_rsa.pub') }}"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
I'm copy the authorized_key value directly from ansible's documentation site. I have looked up at other examples but they don't vary from mine. Again, I'm just trying to deploy my public key from another server to two remote servers in the same subnet. Thanks in advance for your input.