Hello,
thanks a lot! For the sake of people having the same problem as me, here's
a complete task that kills connections to all hosts from the current play:
# this will force Ansible to create new connection(s) so that changes in
ssh
# settings will have effect (normally Ansible uses ControlPersist feature
to
# reuse one connection for all tasks). Note that the path to the socket
must
# be the same as what is configured in ansible.cfg.
- name: kill cached ssh connection
local_action: >
shell ssh -O stop {{ hostvars[item].ansible_ssh_host }}
-o ControlPath=/tmp/ansible-ssh-{{ hostvars[item].ansible_ssh_user }}-{{
hostvars[item].ansible_ssh_host }}-{{ hostvars[item].ansible_ssh_port }}
run_once: yes
register: socket_removal
failed_when: >
socket_removal|failed
and "No such file or directory" not in socket_removal.stderr
with_items: "{{ play_hosts }}"
If you have any further suggestions, let me know!
best,
Jan
On Friday, March 18, 2016 at 9:26:08 PM UTC+1, Brian Coca wrote:
>
> you can run a command to kill the connection locally:
>
> ssh -O stop <hostname>-o
> ControlPath=~/.ansible/cp/ansible-ssh-<hostname>-22-<user>
>
>
> ----------
> Brian Coca
>
--
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/dde2644b-5db7-4819-88b4-6b2fd12b34bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.