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 gather_facts: False tasks: - name: Hello shell: "echo hello" tags: - hello - name: Bye shell: "echo bye" tags: - bye
After updating gather_facts: False in playbook if we execute, it will skip collecting facts and directly execute tasks listed.