Disable ansible gather facts on the command line

Viewed 930

To speed up execution of ansible playbooks, I occasionally want to disable gathering facts during the setup phase. This can be done in the playbook by adding:

gather_facts: False

but how can it be controlled in the command line? I execute my ansible playbook like this:

ansible-playbook playbook.yaml -i inventory.yaml

1 Answers

You can use the ANSIBLE_GATHERING environment variable:

ANSIBLE_GATHERING=explicit ansible-playbook playbook.yaml -i inventory.yaml

Gathering facts is disabled unless the play has explicitly set gather_facts: True.

Related