Ansible Flashcards
What is ansible and how does it work?
Ansible is a tool that provides IT automation where you can write instructions that automate the IT set you would do in the past.
It can also do IT orchestration, where you have to run tasks I. Sequence and create a chain of events which must happen. Of several different servers or devices.
What have you done with Ansible?
- Installed Ansible on control Node
- added Host in inventory.
- configured ansible.cfg (custom inventory and playbook)
*ran ad-hoc commands.
*create ansible playbooks for automation.
How would your convince your manager that provisioning with Ansible is beneficial for the company?
- free: ansible is an open source tool.
- very simple to set up and use: no special coding skills are necessary to use ansible’s playbooks (more on playbooks later).
*powerful: ansible lets you model even in highly complex IT workflows. - flexible: you can orchestrate the entire application environment no matter where it’s deployed. You can also customize it based on your needs.
*Agentlee: you don’t need to install any other software or firewall ports on the client’s systems you want to automate. You also don’t have to set up a separate management structure.
*Efficient because you don’t need to install any extra software. There’s more room for applications resources on your server.
Beside time saving what are other benefits by provisioning with Ansible?
*we can make configuration management.
*we can make manage services and user management at the same time.
How ansible control Node manages the managed nodes?
Through ssh
How we can list all the hosts that ansible is managing?
Ansible all –list-hosts
Can you describe idempotency?
Is the ability to execute an operation several times which provides same results. Meaning if its run once or multiple times.
Are you familiar with Ansible Collection?
Yes I have worked ad-hoc commands, playbooks, roles, managed different modules and add different tasks.
What kind of playbook have you written?
I have written playbooks where I managed users, storage, web server management and patching, lineinfile,
Can you give me the names of modules you have worked with?
Package management, service, copy, debug, lineinfile, users
Where are the modules located?
Default modules
/usr/lib/python2 7/site-packages/ansibles/modules
For local:
/usr/share/ansible/plugins/modules.
Do you know the difference between dynamic and static inventory?
*Dynamic host file is being updated right away in a shell script when the hosts are being decommissioned.
*static inventory file is a plain text file containing a list of managed hosts or remote nodes whose numbers and IP addresses fairly constant.
How to manage your ansible hosts?
Create an inventory which is by default /etc/ansible/hosts.
Where we mention different groups for hosts and different group for managed nodes.
We cam create our customized inventory file anywhere and we call that inventory file.
Ansible uses ssh to communicate with the mentioned inventory.
What is the path to the ansible configuration file?
/etc/ansible/ansible.cfg
How to check ansible version?
Ansible - - version
Do you know the difference between notify and register?
Notify tells the handlers that the tasks has been changed and the handlers will perform the task.
The register is a way to capture the output from the task execution and stores it into a variable.
What is Ad-hoc command why it is really needed?
*Is a way to run a single ansible task quickly on all you managed notes.
*you may want to run the ad hoc command to edit some configuration files, stop/start service on your remote machines update particular pkg, shutdown set of hosts. Or to collect some info such as uptime on all of your servers.
*Ad-hoc command is useful to perform quickly task but it has limited usage.
Have you heard about tags in enviroment?
Tags in playbooks allow you to selectively target certain tasks at tun time.
For example tag:users it will run only that .
Are you familiar with concept of vars? How do we use them?
Vars are variables, we define most of the time on the play level. We can use these variables later in our playbook. We call it in different tasks.
If you want to register the output of a task in your playbook. How do you do that?
Register is the way to capture the output of a task execution and store it in a variable.
Register: (Register name)
How to create multiple users without the need to create multiple users?
*using for loop with a variable that is always {{ ‘item’ }}
*we define the list of user under the variables and then we use loop to call that variable .