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/8e959347-3c44-4b03-a220-60c31906a2a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to