Home » Amazon » AWS DevOps Engineer Professional v.2 » What is the expected behavior if Ansible is called with ‘ansible-playbook -i localhost playbook.yml’?
What is the expected behavior if Ansible is called with ‘ansible-playbook -i localhost playbook.yml’?
A. Ansible will attempt to read the inventory file named ‘localhost’
B. Ansible will run the plays locally.
C. Ansible will run the playbook on the host named ‘localhost’
D. Ansible won’t run, this is invalid command line syntax
Correct Answer: A
Explanation/Reference:
Explanation:
Ansible expects an inventory filename with the ‘-i’ option, regardless if it is a valid hostname. For this to execute on the host `localhost’ resolves to, a comma needs to be appended to the end.
Reference: http://docs.ansible.com/ansible/intro_inventory.html#inventory