exam questions

Exam 350-901 All Questions

View all questions & answers for the 350-901 exam

Exam 350-901 topic 1 question 130 discussion

Actual exam question from Cisco's 350-901
Question #: 130
Topic #: 1
[All 350-901 Questions]

A developer must create VLANs 2-5 on a remote Cisco NX-OS switch by using an Ansible playbook. The playbook must meet these requirements:
✑ Configure the VLANs and a name for each VLAN.
✑ Only run against the switches inventory group.
✑ Execute from the local Ansible controller.
✑ Prevent the collection of system information prior to execution.
Which playbook must be used?
A.

B.

C.

D.

Show Suggested Answer Hide Answer
Suggested Answer: C

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
entropicBoy
Highly Voted 2 years, 9 months ago
it´s D. C has no valid list for the loop
upvoted 14 times
...
duracell
Highly Voted 2 years, 10 months ago
D is the correct answer.
upvoted 8 times
...
examtopicstroilevw
Most Recent 1 month, 3 weeks ago
Answer: D Note: A and B are eliminated, as collect_info is incorrect, it should be gather_facts. Note: gather_facts: no and gather_facts: false are equivalent [more explained about this later], so we must dig deeper to separate C and D. Digging further, they use different looping techniques. C uses the loop D uses with_items I see mistakes in both: C is doing it against a string instead of a list D is missing a colon on the with_items See below for additional reading [including why gather_facts: no and gather_facts: false are equivalent] As letsmeteennaam noted: C does not use a valid list structure. https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html per the link below, we should not get hung up on false versus no, as these are equivalent in ansible: gather_facts: no gather_facts: false https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#boolean-variables
upvoted 1 times
examtopicstroilevw
1 month, 3 weeks ago
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#boolean-variables Please note that the documentation itself should still focus on true/false, and here is an actual link showing gather_facts: false in documentation [but please note, alternative values work just fine, and do not define this question]. "Disabling facts By default, Ansible gathers facts at the beginning of each play. If you do not need to gather facts (for example, if you know everything about your systems centrally), you can turn off fact gathering at the play level to improve scalability. Disabling facts may particularly improve performance in push mode with very large numbers of systems, or if you are using Ansible on experimental platforms. To disable fact gathering: - hosts: whatever gather_facts: false"
upvoted 1 times
examtopicstroilevw
1 month, 3 weeks ago
Also, this link that is used as documentation evidence for 'no' is actually referring to running gather_facts in parallel [which is the default behavior for multiples] https://docs.ansible.com/ansible/2.9/modules/gather_facts_module.html From that page: "Parameter: Parallel choices: no or yes Comments: A toggle that controls if the fact modules are executed in parallel or serially and in order. This can guarantee the merge order of module facts at the expense of performance. By default it will be true if more than one fact module is used."
upvoted 1 times
...
...
...
Pecoto
1 year, 3 months ago
I find this on net: https://aap2.demoredhat.com/exercises/ansible_network/3-facts/ The gather_facts: no is required since as of Ansible 2.8 and earlier, this only works on Linux hosts, and not network infrastructure. We will use a specific module to gather facts for network equipment. As of we working with Switches no Linux I will go with C
upvoted 1 times
...
Ietsmeteennaam
1 year, 4 months ago
What helped me with this question was understanding more about loops and with_* https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html As i was inclined to slect C, but as that does not contain a list, the right answer is D.
upvoted 1 times
...
Jimbojones321
1 year, 6 months ago
I think the answer is C because gather_facts should read false: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#disabling-facts
upvoted 1 times
examtopicstroilevw
1 month, 3 weeks ago
it should be noted that gather_facts: no and gather_facts: false are actually equivalent, as ansible accepts a range of alternatives for true/false, even though their documentation presents true/false: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#boolean-variables
upvoted 1 times
...
...
Teringzooi
2 years, 1 month ago
Correct answer: D
upvoted 1 times
...
designated
2 years, 2 months ago
D is correct: Only run against the switches inventory group. ✑ Execute from the local Ansible controller. - hosts: switches connection: local https://docs.ansible.com/ansible/latest/user_guide/playbooks_delegation.html ✑ Prevent the collection of system information prior to execution. gather_facts: no https://docs.ansible.com/ansible/2.9/modules/gather_facts_module.html#:~:text=This%20module%20is%20automatically%20called,facts%20about%20the%20system%2C%20automatically. ✑ Configure the VLANs and a name for each VLAN. nxos_vlan: vlan_id = {{ item.vid }} name = {{ item.name }} host {{ inventory_hostname }} state: present with_items vlan configuration https://docs.ansible.com/ansible/2.9/modules/nxos_vlans_module.html
upvoted 1 times
designated
2 years, 2 months ago
Notes: The Ansible with_items is a handy plugin to perform loop operations in a playbook. state: present = Manage the state of the resource. vlan_id = 2-5 (range in the variable) inventory_hostname = The inventory name for the ‘current’ host being iterated over in the play https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html
upvoted 1 times
...
...
G_I_Pet3r
2 years, 4 months ago
- I believe it's "C", which is the only one with correct syntax for collecting info (gather_facts) and also boolean, which is wrong in other options. https://docs.ansible.com/ansible/latest/network/getting_started/first_playbook.html#gathering-facts-from-network-devices - As for VLAN naming, "C" looks pretty much like this: https://github.com/datacenter/Ansible-NXOS/blob/master/vlan_ansible.yml
upvoted 3 times
examtopicstroilevw
1 month, 3 weeks ago
this link includes an example that looks like D.
upvoted 1 times
...
razvan999
11 months ago
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#boolean-variables
upvoted 3 times
...
...
testadviser
2 years, 7 months ago
D is correct: https://github.com/datacenter/Ansible-NXOS/blob/master/ADD_VXLAN_TENANT/roles/leaf/tasks/main.yml https://github.com/datacenter/Ansible-NXOS/blob/master/vlan_ansible.yml
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago