I just tried your first playbook on 1.4.4 and it added both keys to the
authorized_keys file. Are you sure that those keys are different files?
Maybe you made a mistake an copied one key to another?
On Saturday, February 22, 2014 5:34:43 PM UTC+1, Yaniv Ferszt wrote:
>
> I'm using 1.4.4 and it is not doing that, it is only appending new keys to
>> the current ones. Maybe something was changed in 1.5. Could you try 1.4.5?
>>
>
> same behaviour with version 1.4.5
>
> [yaniv@yfhv1 playbooks]$ ansible-playbook --version
> ansible-playbook 1.4.5
>
> here are the playbooks i have tested
>
> 1.
>
>
>
>
>
>
>
>
>
>
>
> *[yaniv@yfhv1 playbooks]$ cat ssh-keys.yml---- name: "Set up
> authorized_keys for the root user" hosts: laptop user: root tasks: -
> name: Set up authorized_keys for the root user authorized_key: user=root
> key="{{ item }}" with_file: -
> /home/yaniv/playbooks/public-keys/user-a -
> /home/yaniv/playbooks/public-keys/user-b*
>
> only the key from user-b stays in the authorized_keys file. even if i run
> it multiple times.
>
> 2.
>
>
>
>
>
>
>
>
>
> *[yaniv@yfhv1 playbooks]$ cat ssh-test.yml---- name: "Set up
> authorized_keys for the root user" hosts: laptop user: root tasks: -
> name: Set up user-a authorized_keys for the root user authorized_key:
> user=root key="{{ lookup('file',
> '/home/yaniv/playbooks/public-keys/user-a') }}" state=present - name: Set
> up user-b authorized_keys for the root user authorized_key: user=root
> key="{{ lookup('file', '/home/yaniv/playbooks/public-keys/user-b') }}"
> state=present*
>
> same as before only the key from user-b stays in the authorized_keys file.
>
> 3.
> separated playbooks for every user same result. only the last executed
> playbook is left in the authorized_keys file.
>
>
>
>
>
>
>
>
> *[yaniv@yfhv1 playbooks]$ cat ssh1-test.yml---- name: "Set up
> authorized_keys for the root user" hosts: laptop user: root tasks: -
> name: Set up user-a authorized_keys for the root user authorized_key:
> user=root key="{{ lookup('file',
> '/home/yaniv/playbooks/public-keys/user-a') }}" state=present*
>
>
>
>
>
>
>
>
>
> *[yaniv@yfhv1 playbooks]$ cat ssh2-test.yml---- name: "Set up
> authorized_keys for the root user" hosts: laptop user: root tasks: -
> name: Set up user-b authorized_keys for the root user authorized_key:
> user=root key="{{ lookup('file',
> '/home/yaniv/playbooks/public-keys/user-b') }}" state=present*
>
>
>
--
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/ee2a0faa-1824-414d-86a1-46d9c0a9271d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.