Вы находитесь на странице: 1из 3

EXTENDING ANSIBLE

REVIEW QUESTIONS AND HANDS-ON CHALLENGES

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?

DYNAMIC INVENTORY AND DYNAMIC HOSTS


§   What is a dynamic inventory?
§   How can you specify a dynamic inventory script with Ansible?
§   How can you pass host variables from dynamic inventory script into
Ansible? Which alternative should be preferred? Why?
§   How can you create dynamic hosts or groups from within an Ansible
playbook?
§   How can you combine dynamic inventory with host- or group variables?
§   What are the limitations of dynamic hosts?

1
Questions marked with R require additional research.

© Copyright ipSpace.net 2017 Page 1

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.

Dynamic inventory script could be something as simple as a shell script that


displays a static JSON file. Create a JSON file in dynamic inventory format and
write an Ansible playbook that will use that file to ping specified network
devices and report which ones are not reachable.

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?

© Copyright ipSpace.net 2017 Page 2

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?

© Copyright ipSpace.net 2017 Page 3

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

Вам также может понравиться