I think that your only problem is indentation, you have to be careful with
it. I used your code and added indentation:
---
- name: "Set up authorized_keys for the root user"
hosts: testvms
user: root
tasks:
- name: Set up authorized_keys for the root user
authorized_key: user=root key="{{ item }}"
with_file:
- /path/to/pub-key/user-a
- /path/to/pub-key/user-b
Also I'm not sure what user: root exactly does in a playbook, I know there
is an option remote_user: which sets the user which will run the playbook
and it's root by default, so you can remove that line probably.
On Friday, February 21, 2014 1:45:05 PM UTC+1, Yaniv Ferszt wrote:
>
> Hi,
>
> I am just starting to learn ansible and have a question regarding the
> "authorized_key" Modul.
>
> what i am trying to accomplish is add multiple ssh public keys to a remote
> systems root user.
>
>
> in the documentation http://docs.ansible.com/authorized_key_module.html
>
> i see that i need something like this
>
>
> *# Using with_file
> - name: Set up authorized_keys for the deploy user
> authorized_key: user=deploy
> key="{{ item }}"
> with_file:
> - public_keys/doe-jane
> - public_keys/doe-john*
>
>
> so i created a playbook "ssh-keys.yml" with this contend
>
>
>
>
>
>
>
>
>
>
>
>
> *---- name: "Set up authorized_keys for the root user" hosts: testvms user:
> root tasks:- name: Set up authorized_keys for the root user authorized_key:
> user=root key="{{ item }}" with_file: -
> /path/to/pub-key/user-a - /path/to/pub-key/user-b*
>
>
> i receive the following error running this playbook
>
> *# ansible-playbook -v ssh-keys.yml ERROR: with_file is not a
> legal parameter in an Ansible Playbook*
>
>
> OS Information
>
>
>
>
>
> *ansible server# cat /etc/redhat-release Red Hat Enterprise Linux Server
> release 6.4 (Santiago)# ansible-playbook --versionansible-playbook 1.5*
>
>
> any idea what i did wrong?
>
>
>
>
>
>
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/9a2fc5e0-a5a0-4c78-ad76-38915ca002ca%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.