There are multiple way to improve the performance. I have noticed multiple time yum ansible module slow down the performance.
Try to use the pipelining or mitogen Please refer the below URL https://www.toptechskills.com/ansible-tutorials-courses/speed-up-ansible-playbooks-pipelining-mitogen/# On Thu, 10 Sep, 2020, 8:59 pm Pankaj Basnal, <[email protected]> wrote: > Hi, > I'm new to ansible and I'm facing an issue with executing our playbook. > > Setup- > * For 10 hosts on azure > * all hosts are identical and newly created > * ansible.cfg- > [defaults] > host_key_checking = False > > * portion of playbook that is installing packages > > - name: Set Initscripts to be Installed > set_fact: > > packages_to_install: "{{ packages_to_install | default([]) + [ > 'initscripts' ] }}" > tags: > - common > when: ansible_distribution_major_version is version_compare('7', '<') > > - name: Set Java to be Installed > set_fact: > > packages_to_install: "{{ packages_to_install | default([]) + [ > jboss_java_pkg_name ] }}" > when: install_java|bool > tags: > - common > > - name: Set Unzip to be Installed > set_fact: > > packages_to_install: "{{ packages_to_install | default([]) + [ 'unzip' ] > }}" > tags: > - common > > - name: Install packages > package: > name: "{{ packages_to_install }}" > state: present > register: packages_result > retries: 5 > until: packages_result is success > > At the step of package installation, ansible will freeze without any log > output for 2 hours and then finally it will throw ssh connection error that > host is unreachable. > > Logs of the run > * 9/8/2020 8:18:08 PM : "download_only": false, > > * 9/8/2020 8:18:20 PM : 17403 1599576500.81986: _low_level_execute_command(): > executing: /bin/sh -c 'rm -f -r > /home/wbuser/.ansible/tmp/ansible-tmp-1599576402.5-17403-228811267706642/ > > /dev/null 2>&1 && sleep 0' > * 9/8/2020 8:18:20 PM : >>><<< > > * 9/8/2020 8:18:20 PM : 17403 1599576500.86101: attempt loop complete, > returning result > * 9/8/2020 8:18:20 PM : 17403 1599576500.86111: dumping result to json > * 9/8/2020 8:18:20 PM : "invocation": { > * 9/8/2020 8:18:20 PM : "update_cache": false, > > * 9/8/2020 8:18:20 PM : "unzip-6.0-21.el7.x86_64 providing unzip is already > installed", > * 9/8/2020 10:28:42 PM : 17410 1599584322.50669: stderr chunk (state=3): > * 9/8/2020 10:28:42 PM : >>>Shared connection to 52.225.188.39 closed. > * 9/8/2020 10:28:42 PM : <<< > * 9/8/2020 10:28:42 PM : 17410 1599584322.50769: stderr chunk (state=3): > * 9/8/2020 10:28:42 PM : >>><<< > * 9/8/2020 10:28:42 PM : 17410 1599584322.50780: stdout chunk (state=3): > * 9/8/2020 10:28:42 PM : >>><<< > > * 9/8/2020 10:28:42 PM : <52.225.188.39> (255, '', 'Shared connection to > 52.225.188.39 closed.\r\n') > > * 9/8/2020 10:28:42 PM : 17410 1599584322.50832: > _low_level_execute_command(): starting > > * 9/8/2020 10:28:42 PM : 17410 1599584322.50843: > _low_level_execute_command(): executing: /bin/sh -c 'rm -f -r > /home/wbuser/.ansible/tmp/ansible-tmp-1599576402.86-17410-193336400580842/ > > /dev/null 2>&1 && sleep 0' > > * 9/8/2020 10:28:42 PM : <52.225.188.39> ESTABLISH SSH CONNECTION FOR USER: > wbuser > > * 9/8/2020 10:28:42 PM : <52.225.188.39> SSH: EXEC ssh -C -o > ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o > Port=33000 -o 'IdentityFile="/tmp/AnsibleFiles/id_rsa"' -o > KbdInteractiveAuthentication=no -o > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o > PasswordAuthentication=no -o 'User="wbuser"' -o ConnectTimeout=10 -o > StrictHostKeyChecking=no -o ControlPath=/root/.ansible/cp/cccd982d88 > 52.225.188.39 '/bin/sh -c '"'"'rm -f -r > /home/wbuser/.ansible/tmp/ansible-tmp-1599576402.86-17410-193336400580842/ > > /dev/null 2>&1 && sleep 0'"'"'' > * 9/8/2020 10:28:43 PM : 17410 1599584323.14653: stderr chunk (state=2): > * 9/8/2020 10:28:43 PM : >>><<< > * 9/8/2020 10:28:43 PM : 17410 1599584323.14667: stdout chunk (state=2): > * 9/8/2020 10:28:43 PM : >>><<< > * 9/8/2020 10:28:43 PM : <52.225.188.39> (0, '', '') > > * 9/8/2020 10:28:43 PM : 17410 1599584323.14703: _low_level_execute_command() > done: rc=0, stdout=, stderr= > * 9/8/2020 10:28:43 PM : 17410 1599584323.14742: _execute() done > * 9/8/2020 10:28:43 PM : 17410 1599584323.14745: dumping result to json > > * 9/8/2020 10:28:43 PM : 17410 1599584323.14750: done dumping result, > returning > > * 9/8/2020 10:28:43 PM : 17410 1599584323.14777: done running TaskExecutor() > for JbossEAP-26/TASK: jboss_common_role : Install packages > [000d3ae7-f205-69c8-6cc1-0000000000c9] > > * 9/8/2020 10:28:43 PM : 17410 1599584323.14799: sending task result for task > 000d3ae7-f205-69c8-6cc1-0000000000c9 > > * 9/8/2020 10:28:43 PM : 17410 1599584323.15331: done sending task result for > task 000d3ae7-f205-69c8-6cc1-0000000000c9 > * 9/8/2020 10:28:43 PM : 17410 1599584323.15339: WORKER PROCESS EXITING > * 9/8/2020 10:28:43 PM : fatal: [JbossEAP-26]: UNREACHABLE! => { > * 9/8/2020 10:28:43 PM : "changed": false, > > * 9/8/2020 10:28:43 PM : "msg": "Failed to connect to the host via ssh: > Shared connection to 52.225.188.39 closed.", > * 9/8/2020 10:28:43 PM : "unreachable": true > * 9/8/2020 10:28:43 PM : } > > Can anyone help in understanding why this would be happening and what > measures I can take to prevent this? > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/9911e46a-5342-41d8-bd6f-7a50548e8bd6n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/9911e46a-5342-41d8-bd6f-7a50548e8bd6n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAKG6amekz1%3DcKrDr0osBpqOUB1NkwK5YtT%3DfBKo%3DYvL%2BxTCm2Q%40mail.gmail.com.
