# Reconnect after the user is added

**URL:** <https://forum.ansible.com/t/reconnect-after-the-user-is-added/17160>\
**Category:** Ansible Project\
**Created:** [December 30, 2014, 1:25pm UTC](https://forum.ansible.com/t/reconnect-after-the-user-is-added/17160 "2014-12-30T13:25:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anatoly\_techtonik](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@anatoly\_techtonik](https://forum.ansible.com/u/anatoly_techtonik)\
**Post date:** [December 30, 2014, 1:25pm UTC](https://forum.ansible.com/t/reconnect-after-the-user-is-added/17160/1 "2014-12-30T13:25:47Z")

</div>

Hi.

Is there a way to make Ansible reconnect to continue? I am adding user and I need to execute the rest of the operations under this user - making checkout of the project with his forwarded SSH key.

---

<div class="post-metadata">

**Author:** ![Paul\_Totterman](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@Paul\_Totterman](https://forum.ansible.com/u/Paul_Totterman)\
**Post date:** [December 30, 2014, 3:51pm UTC](https://forum.ansible.com/t/reconnect-after-the-user-is-added/17160/2 "2014-12-30T15:51:16Z")

</div>

Hi Anatoly,

> Is there a way to make Ansible reconnect to continue? I am adding user and I need to execute the rest of the operations under this user - making checkout of the project with his forwarded SSH key.

Remember that one playbook in ansible can contain several plays. Create the user in the first play and run the second play as the freshly created user.

Cheers,  
Paul

---

<div class="post-metadata">

**Author:** ![anatoly\_techtonik](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@anatoly\_techtonik](https://forum.ansible.com/u/anatoly_techtonik)\
**Post date:** [January 3, 2015, 10:52am UTC](https://forum.ansible.com/t/reconnect-after-the-user-is-added/17160/3 "2015-01-03T10:52:21Z")

</div>

Hi Paul,

---

<div class="post-metadata">

**Author:** ![Paul\_Totterman](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@Paul\_Totterman](https://forum.ansible.com/u/Paul_Totterman)\
**Post date:** [January 3, 2015, 2:34pm UTC](https://forum.ansible.com/t/reconnect-after-the-user-is-added/17160/4 "2015-01-03T14:34:22Z")

</div>

> Thanks for the hint. Does that mean that Ansible reconnect to remote  
> machine after each play? (Can’t test it right now)

If you increase the verbosity using -v you’ll see that ansible connects for each task. But it’s probably easier to group tasks to be executed with a certain user as a play.

Cheers,  
Paul
