My corporate firewall policy allows only 20 connections per minute 60 seconds between the same source and destinations.
Owing to this the ansible play hangs after a while.
I would like multiple tasks to use the same ssh session rather than creating new sessions. For this purpose i set the below pipelining = True in the local folder ansible.cfg as well as in the command line.
cat /opt/automation/startservices/ansible.cfg
[defaults]
host_key_checking = False
gathering = smart
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=600s
control_path = %(directory)s/%%h-%%r
pipelining = True
ANSIBLE_SSH_PIPELINING=0 ansible-playbook -i /opt/automation/startservices/finalallmw.hosts /opt/automation/startservices/va_action.yml -e '{ dest_host: myremotehost7 }' -e dest_user=oracle
The playbook is too big to be shared here but it is this task which loops and this is where it hangs due to more than 20 ssh connections in 60 seconds.
171 - name: Copying from "{{ inventory_hostname }}" to this ansible server.
172 synchronize:
173 src: "{{ item.path }}"
174 dest: "{{ playbook_dir }}/homedirbackup/{{ inventory_hostname }}/{{ dtime }}/"
175 mode: pull
176 copy_links: yes
177 with_items:
178 - "{{ to_copy.files }}"
With the pipelining settings set; my play still hangs after 20 connections.
Below are the playbook settings:
45 hosts: "{{ groups['dest_nodes'] | default(groups['all']) }}"
46 user: "{{ USER | default(dest_user) }}"
47 any_errors_fatal: True
49 gather_facts: false
51 tags: always
52
53 vars:
54 ansible_host_key_checking: false
55 ansible_ssh_extra_args: -o StrictHostKeyChecking=no -o ConnectionAttempts=5
Can you please suggest any solution to the issue on the ansible side where all tasks use the same ssh session and is pipelining not working here?