300-635 practice question 9 of 15

An engineer is implementing a Cisco Nexus switch. Which command executes an Ansible playbook called n9k.yml?

Full set: 75 questions
Answer options
A: ansible-playbook n9k.yml Correct answer
B: ansible-playbook -f n9k.yml -run now
C: ansible-playbook -f n9k.yml
D: ansible-playbook -f N9K.yml
Correct Answer:
A. ansible-playbook n9k.yml
Explanation

The standard and correct command to execute an Ansible playbook is ansible-playbook followed by the path to the playbook file. In this scenario, the playbook is named n9k.yml, so the command is ansible-playbook n9k.yml. This command instructs Ansible to read the specified YAML file and execute the tasks defined within it against the hosts defined in the inventory.

Why Incorrect

B: The -f flag is an alias for --forks and requires an integer value. The -run now arguments are not valid for the ansible-playbook command. C: The -f flag is used to specify the number of parallel processes (forks) and expects an integer, not the playbook filename. The playbook name is a positional argument. D: This option incorrectly uses the -f flag for the filename. The playbook name should be provided as a direct argument without any flag.

References

1. Ansible Documentation. (n.d.). ansible-playbook - Run Ansible playbooks. Red Hat. Retrieved from https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html. (The official documentation shows the syntax as ansible-playbook ).

2. Ansible Documentation. (n.d.). Working with playbooks. Red Hat. Retrieved from https://docs.ansible.com/ansible/latest/userguide/playbooksintro.html#running-playbooks. (This guide provides the basic command for running a playbook).

Scroll to Top