Last active
July 19, 2016 14:07
-
-
Save todd-dsm/1ab1c13cd4635d1465f83e901eccf55d to your computer and use it in GitHub Desktop.
"invalid key specified: lookup( 'file', 'sources/keys/newUser.pub') }}"}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat sources/keys/newUser.pub | |
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRxc4tyOZ8dPM6O3NPWcZjk9KZRdNEbOfHwvSptBk7wCs8WqzRaNoAY4Al3ZERSwjSr7yhz4NkJSw6xaX+MzkKkQboLglsDoZTCVh44uOPOGU2K8zKwuu5YxdkbpFVF5M6tzD625dMvpZf91qj+l9ViizoRqI+WzdYRqxYnqtfL+jUygvIZ4wakucxKsM1T+aKe4K+JzoAGPfSssIZO0l0nTVmmpOx83CKeXWZRv2GK5KvsrzQFGdTBlewvI9LLurUxQ4y5Iu9rWAB2KA97QPgLQlVqogUeTTmdRYf1tUzXMB/C4oWl1oeiEKFpndybXotgP3gnoyjUshOYaxjEibj newUser@host | |
-------------------------------------------------------------------------------- | |
- hosts: host_group | |
become: yes | |
become_method: sudo | |
tasks: | |
- name: add development user to the system | |
user: name=newUser comment="GECOS" uid=1013 groups=wheel | |
- name: injecting users public ssh key into remote authorized_keys file | |
authorized_key: | |
user: newUser | |
#key: sources/keys/newUser.pub | |
key: "lookup( 'file', 'sources/keys/newUser.pub') }}" | |
state: present | |
exclusive: yes | |
-------------------------------------------------------------------------------- | |
$ ansible-playbook add-dev-user.yml | |
PLAY [safworx-dev] ************************************************************* | |
TASK [setup] ******************************************************************* | |
ok: [safworx.fbfs.com] | |
TASK [add development user to the system] ************************************** | |
ok: [safworx.fbfs.com] | |
TASK [injecting users public ssh key into remote authorized_keys file] ********* | |
fatal: [safworx.fbfs.com]: FAILED! => {"changed": false, "failed": true, "msg": "invalid key specified: lookup( 'file', 'sources/keys/newUser.pub') }}"} | |
NO MORE HOSTS LEFT ************************************************************* | |
to retry, use: --limit @add-dev-user.retry | |
PLAY RECAP ********************************************************************* | |
safworx.fbfs.com : ok=2 changed=0 unreachable=0 failed=1 | |
-------------------------------------------------------------------------------- | |
$ file sources/keys/newUser.pub | |
sources/keys/newUser.pub: OpenSSH RSA public key | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment