User:Tom/RHCS EX407
Red Hat Certified Specialist in Ansible Automation exam
Exam based on RedHat 7.3. and Ansible 2.3.
Objectives
- Using Ansible inventories to define groups of hosts
- Creating Ansible playbooks
- Using Ansible playbooks to configure systems to a specified state
- Creating and using Ansible templates to create customized configuration files for hosts
- Creating Ansible roles
- Using Ansible Vault in playbooks to protect sensitive data
- Installing Ansible Tower and using it to manage systems
Study points for the exam
To help you prepare, the exam objectives highlight the task areas you can expect to see covered in the exam. Red Hat reserves the right to add, modify, and remove exam objectives. Such changes will be made public in advance.
Candidates should have the following skills and abilities: Understand core components of Ansible Inventories Modules Variables Facts Plays Playbooks Configuration files
Run ad-hoc Ansible commands Use both static and dynamic inventories to define groups of hosts Utilize an existing dynamic inventory script Create Ansible plays and playbooks Know how to work with commonly used Ansible modules Use variables to retrieve the results of running a commands Use conditionals to control play execution Configure error handling Create playbooks to configure systems to a specified state Selectively run specific tasks in playbooks using tags
Create and use templates to create customized configuration files Work with Ansible variables and facts Create and work with roles Download roles from an Ansible Galaxy and use them Manage parallelism Use Ansible Vault in playbooks to protect sensitive data Install Ansible Tower and use it to manage systems Use provided documentation to look up specific information about Ansible modules and commands
Training
- Course introduction
Introduce and review the course.
- Introduce Ansible
Describe the terminology and architecture of Ansible.
Deploy Ansible Install Ansible and run ad hoc commands.
Implement playbooks Write Ansible plays and execute a playbook.
Manage variables and inclusions Describe variable scope and precedence, manage variables and facts in a play, and manage inclusions.
Implement task control Manage task control, handlers, and tags in Ansible playbooks.
Implement Jinja2 templates Implement a Jinja2 template.
Implement roles Create and manage roles.
Configure complex playbooks Configure connection types, delegations, and parallelism.
Implement Ansible Vault Manage encryption with Ansible Vault.
Troubleshoot Ansible Troubleshoot the Ansible control machine and managed nodes.
Implement Ansible Tower Implement Ansible Tower.
Implement Ansible in a DevOps environment Implement Ansible in a DevOps environment using Vagrant.
Comprehensive review Review tasks from the Automation with Ansible course
Zoekuit
This study guide attempts to cover topics for study in the Red Hat EX407 Red Hat Certificate of Expertise in Ansible Automation exam
Understand core components of Ansible
Inventories
Supply inventory with -i flag with commands
ansible -i inventory -m shell -a “hostname"
Can be set in ansible.cfg
inventory = /etc/ansible/hosts
Static inventory
defined in ini style [router] hostname1 ansibe_host=192.168.1.1 [webserver] hostname2 ansibe_host=192.168.1.2 [database] hostname3 ansibe_host=192.168.1.3 [appserver] hostname4 ansible_host=192.168.1.4
Dynamic inventory
returns json {
"all": {
"hosts": [
"slaves_slave1"
]
},
"_meta": {
"hostvars": {
"slaves_slave1": {
"ansible_host": "192.168.121.74"
}
}
}
}
Modules
file, stat, lineinfile etc
file module example
Module usage file:
path: /etc/config.cnf state: absent
Short hand
file: path=”/etc/config.cnf” state=”absent”
Variables
Variable can be used in inventories, playbooks, roles, defaults
Facts
Hostvars
Setup module to retrieve facts
Debug module to verify facts
Plays
Individual roles
Playbooks
File with a collection of roles/plays
Configuration files
/etc/ansible/ansible.cfg
Run ad-hoc Ansible commands ansible [groupname] [-i inventory-file] [-m module] [-a arguments] ansible all -i inventory -m shell -a “hostname”
Use both static and dynamic inventories to define groups of hosts
Static inventory take single hosts by line or ini format
Dynamic inventories return information from outside sources like AWS to gather facts about the inventory
Example for creating dynamic inventories
https://www.jeffgeerling.com/blog/creating-custom-dynamic-inventories-ansible
Utilize an existing dynamic inventory script
./inventory.py {} ./inventory.py --list {"all": {"hosts": ["slaves_slave2", "slaves_slave3", "slaves_slave4", "slaves_slave1", "slaves_slave5"]}, "_meta": {"hostvars": {"slaves_slave5": {"ansible_host": "192.168.121.32"}, "slaves_slave4": {"ansible_host": "192.168.121.29"}, "slaves_slave1": {"ansible_host": "192.168.121.218"}, "slaves_slave3": {"ansible_host": "192.168.121.34"}, "slaves_slave2": {"ansible_host": "192.168.121.119"}}}} ./inventory.py --host { "all": { "hosts": [ "slaves_slave1" ] }, "_meta": { "hostvars": { "slaves_slave1": { "ansible_host": "192.168.121.218" } } } }
Create Ansible plays and playbooks
Know how to work with commonly used Ansible modules
Use variables to retrieve the results of running a commands
Use conditionals to control play execution
Configure error handling
fail module - fail:
msg: "The system may not be provisioned according to the CMDB status." when: cmdb_status != "to-be-staged"
Create playbooks to configure systems to a specified state
Selectively run specific tasks in playbooks using tags
Create and use templates to create customized configuration files
Work with Ansible variables and facts
Create and work with roles
Download roles from an Ansible Galaxy and use them
Manage parallelism
Use Ansible Vault in playbooks to protect sensitive data
Install Ansible Tower and use it to manage systems
Use provided documentation to look up specific information about Ansible modules and commands
List of modules
Module example