When we execute an ansible playbook by default it will gather facts of operating system first and then execute tasks listed in it.
Its always not required to gather facts & if we have too many hosts it will take more time to execute a playbook.
To mitigate this we need to disable gather facts with “gather_facts” attribute in ansible playbook.
By default gather_facts attributes value is True, to disable it we need to set it as False.
Here is my play book example with gather_facts: False
- hosts: all
- name: Hello
shell: "echo hello"
- name: Bye
shell: "echo bye"
After updating gather_facts: False in playbook if we execute, it will skip collecting facts and directly execute tasks listed.