Take a look at asynchronous actions:
http://docs.ansible.com/ansible/playbooks_async.html


On Friday, March 18, 2016 at 12:39:28 PM UTC-5, [email protected] wrote:
>
> Hello,
>
> by default Ansible uses SSH's ControlPersist feature to reuse one ssh 
> connection for running multiple tasks.  This is very nice and helpful.  
> However, there is one situation when this is a problem: when I change sshd 
> configuration, I want Ansible to start a new connection so that it will use 
> new configs.
>
> My playbook basically looks like this: 
>
> - hosts: all
>   tasks:
>     - name: change ssh config from X to Y
>       notify: reload ssh
>
> - hosts: all
>   tasks:
>     - [do more stuff that requires ssh to have config Y]
>
> Right now, ansible reuses the connection established for running first 
> play (when ssh configuration was X) in the second play - but the second 
> play fails when ssh configuration is X.  Can I force Ansible to create a 
> new connection between these two plays?
>
> Note that I don't want to disable ControlPersist completely because it's 
> quite useful.
>
> best,
> Jan
>

-- 
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/d7459221-1223-4a72-80b7-854cb879ff34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to