>
> 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/82112039-da83-44cb-8720-2d08d2aee32e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to