# question on loop

**URL:** <https://forum.ansible.com/t/question-on-loop/24875>\
**Category:** Ansible Project\
**Created:** [July 3, 2017, 3:07am UTC](https://forum.ansible.com/t/question-on-loop/24875 "2017-07-03T03:07:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rake](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@rake](https://forum.ansible.com/u/rake)\
**Post date:** [July 3, 2017, 3:07am UTC](https://forum.ansible.com/t/question-on-loop/24875/1 "2017-07-03T03:07:04Z")

</div>

I have requirement where i have to create ssh keys for user on given list of servers and collect all the key from each server and copy into all servers.

Example :-

node1  
node2  
node3

user:-

webadmin

create key for webadmin on three servers and collect web admin key of all three servers and place into each server

I will pass host list as

sudo ansible-playbook rakesh.yml -i /home/rak/hostlist

Can some one help me with this kind of requirement.  
Any Help is much appreciated

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [July 3, 2017, 1:25pm UTC](https://forum.ansible.com/t/question-on-loop/24875/2 "2017-07-03T13:25:09Z")

</div>

That sounds a bit like this example from the loop documentation in ansible: [http://docs.ansible.com/ansible/playbooks\_loops.html#looping-over-subelements](http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-subelements)

Hope this helps.

Jon
