Using Ansible documentation
For this challenge we will examine an already created Ansible Playbook
Ansible for Network Automation Documentation
-
Specific Network Automation Section for Ansible including a getting started guide
Accessing the Ansible docs
-
With the use of the latest command utility ansible-navigator, one can trigger access to all the modules available to them as well as details on specific modules.
ansible-navigator doc -l -m stdoutYou will see the following output:add_host amazon.aws.aws_az_facts amazon.aws.aws_caller_facts amazon.aws.aws_caller_info
A formal introduction to ansible-navigator and how it can be used to run playbooks in the following exercise.
Lets get started
That is the end of of your lab briefing!
Step 1 - Using documentation
-
Enter the
ansible-navigatorinteractive mode on the terminal tabansible-navigatorYou will see the following:`:doc <plugin>`
-
To show how this works, use the
debugmodule by typing:doc debug:doc debugThe documentation for the debugmodule is now displayed in you interactive terminal session. This is a YAML representation of the same exact documentation you would see on docs.ansible.com. Examples can be cut and paste directly from the module documentation into your Ansible Playbook. -
When referring to a non-built in module, there is three important fields:
namespace.collection.module
For example:cisco.ios.facts
Explanation of terms:
-
namespace - example cisco - A namespace is grouping of multiple collections. The cisco namespace contains multiple collections including ios, nxos, and iosxr.
-
collection - example ios - A collection is a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. The ios collection contains all the modules for Cisco IOS/IOS-XE
-
module - example facts - Modules are discrete units of code that can be used in a playbook task. For example the facts modules will return structured data about that specified system.
-
-
Press the Esc key to return to the main menu. Try repeating the
:doccommand with thecisco.ios.factsmodule.:doc cisco.ios.factsWe will be using the facts module in our playbook.