I'm writing a playbook to manage iptables (yes, I know there is a module for this, but I prefer to use a custom playbook). After loading my new rules, I wait for a USR1
signal. If not, I make a rollback.
So, relevant ansible tasks look like this:
- name: Restore iptables
shell: /root/load_iptables_rules.sh
async: 45
poll: 0
- name: Test SSH connection
shell: /root/send_usr1.sh
register: exit_code
until: exit_code.rc == 0
retries: 10
async: 45
poll: 3
I want the second task ("Test SSH Connection") to run in a new, different SSH connection. That way I can confirm that my host is really accepting new SSH connections. Otherwise, Ansible may use the already established connection, and that would not suffice my needs.
I read something about pipelining and async, but I couldn't get it working.