Part 1 Flashcards
What is another name for an Ansible server?
A control node
What are modules?
Command to be executed client-side
Most tasks have a pre-written module
docs.ansible.com -> module index
galaxy.ansible.com -> modules
What is it called when you combine the below modules together:
install httpd
enable httpd service
start httpd service
Where do tasks reside?
Each item on its own is a task. These tasks would be part of a play if they affected the same group of servers, which here they most likely would.
The task resides in a YAML file
What is a playbook
Automation file with step by step execution for multiple tasks.
Name the three pieces of automation in Ansible. (Like the name of automation thing you want done + where those go + where those go)
Module
Task
Playbook
What is YAML?
Yet another markup language
Playbooks are written in YAML.
What is inventory
File called ‘hosts’ contains our inventory (servers listed that we can work with)
What is a tag
Reference or Alias to a task. You can add a task tag to a playbook and just call that task via your tag so you don’t have to run the whole playbook.
What is a Variable
Container that holds a value that you can use repetitively
What is a Role
Directory used for related item in the role. They are all aggregated and stored in /var/ansible/roles for easy access and use.
What are modules called for related tasks?
What are plays called togther?
Play
All plays together make a playbook
These playbooks are written as a file format called YAML
for instance if you install, enable and start httpd, that’s considered a play since they’re all related to the same servers. Like the if all the tasks were to be performed on the same web servers, that would be called a play.
Opening port 80 on the firewall is a different play
If you added creating a db, starting a table and restarting the db with that, all these would go into a playbook. These would all be part of the same YAML file.
How would you run modules through the YAML file
How would you run a specific module ping
ansible-playbook -i my_servers example.yml
ansible myservers -m ping
Where are the ansible config files located?
/etc/ansible/ansible.cfg
/etc/ansible/hosts
/etc/ansible/roles <- separate plays on separate files. Less cluttered to do that.
Ansible install documentation link
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
Install ansible
Version 7 linux
dnf install epel-relaes
dnf install ansible
Version 8 Linux
dnf install epel-release
dnf install python -y
dnf install ansible ansible-doc
redhat 8
subscription-manager repos –enable ansible-2.8-for-rhel-8-x86_64-rpms
dnf install ansible
it’s actually dnf install ansible-core
SELINUX
if selinux is enabled install
dnf libselinux-python
might be python3-libselinux insead
Ansible on RHEL9 is not available, you will need to do the smaller version - ansible-core