Академический Документы
Профессиональный Документы
Культура Документы
After watching the videos in the Extending Ansible, try to answer these review
questions or create the required Ansible playbooks.
EXTENDING ANSIBLE
§ How can you execute an external program from Ansible?
§ [R1] How can you pass data to an external program executed from
Ansible?
§ How can an external program pass structured data back to Ansible? How
can you use this data in Ansible?
§ Can you write your own Ansible modules? When would you want to do
that?
§ What kinds of Ansible plugins can you write?
§ What’s the fundamental difference between Ansible module and Ansible
plugin?
§ How can you build a list of hosts to be managed by Ansible if you don’t
know them in advance?
§ [R] Can you combine static and dynamic inventories? How?
§ [R] How can you integrate Ansible logic (for example, playbooks) into your
orchestration system?
§ What is an Ansible callback? What can they do? When would you use
them?
1
Questions marked with R require additional research.
This material is copyrighted and licensed for the sole use by Mikel Maeso (mikel.maeso@gmail.com [85.87.178.33]). More information at http://www.ipSpace.net/Webinars
HANDS-ON PRACTICE
Write an Ansible playbook that collects the list of LLDP neighbors from a
network device and reports their uptime.
CALLBACK PLUGINS
§ What is a callback plugin?
§ What can they do?
§ Why would you want to use one?
§ How do you enable callbacks in Ansible?
§ Where can you store custom callbacks? How do you point Ansible to them?
§ What are some useful callbacks? When would you use them?
§ When would you use the dense STDOUT callback?
§ How can you display task-specific information with selective callback?
§ When would you use the json callback?
HANDS-ON PRACTICE
Write an Ansible playbook that fails, and use json callback to collect playbook
execution statistics. How would you identify that a task has failed? Can you
write a jq transformation that would return the names of the failed tasks?
This material is copyrighted and licensed for the sole use by Mikel Maeso (mikel.maeso@gmail.com [85.87.178.33]). More information at http://www.ipSpace.net/Webinars
JINJA2 FILTERS AND TESTS
§ Why would you want to write Jinja2 filters and tests?
§ What problems can you solve with a custom Jinja2 filter?
§ How can you use a custom Jinja2 filter?
§ How can you test your Jinja2 filters?
§ Why is it a good idea to write your Jinja2 filters as a class methods and
not global functions?
§ How do you tell Ansible which filters you implemented in your plugin?
§ Why should you check the parameters passed to your custom filters?
§ [R] Why should you check the type of the parameters passed to your
customer filter?
§ [R] Why should you write unit tests for your custom plugins?
§ How would you test that your filter fails (and reports expected errors)
when getting invalid input values?
§ How do you tell Ansible where to look for your custom plugins?
§ How can you write data collected by Ansible into an external database?
§ How can you import data from an external database into Ansible?
This material is copyrighted and licensed for the sole use by Mikel Maeso (mikel.maeso@gmail.com [85.87.178.33]). More information at http://www.ipSpace.net/Webinars