In this video I will cover what is Ansible. How it works. Pros and Cons and where to find out more information.
So what is Ansible? Ansible is an agentless automation and configuration tool. Ansible can also be used for workflow automation. It can do anything from provision servers to run one off commands on many host or host groups in parallel.
Ansible is written in python and uses ssh to execute commands on different systems. Ansible uses a inventory to group and nest systems.
In Ansible you uses modules to create task that do things. You put task in playbooks which are written YAML.
An example of a one off command would be
ansible server1 -a "hostname"
Note: the default module is shell. I also already have my .ansible.cfg and inventory set up which Ill cover in a future video.
Now an example of a playbook I have written todo the same thing
nathan@thenathan:~$ cat ansible/hostname.yml
– name: Get Hostname
– name: Run Shell command hostname
nathan@thenathan:~$ ansible-playbook ansible/hostname.yml
server1 | SUCCESS | rc=0 >>
Lets cover some of the pros and cons.
A pro and a con is its againtless. Its nice that you can use ssh and not have to for the most part install software or make firewall changes for off ports. Thats also a con because if a system is down or times out the change or command wont be applied unless you rerun it.
Ansible inventory is fantastic. Its very powerfull in the way you can group and nest systems which makes it a great tool if you want to run adhock shell commands.
Which also makes Ansible a good fit for running along side other tools like chef.
Ansible does a good job of gathering information (AKA Facts) off systems which you can use to customize commands or configs.
Playbooks use yaml. Its up to you if that’s a pro or con.
Ansible has great documentation which is another pro. I find the documentation and examples better then salt stack and chef. You can find the documentation at https://docs.ansible.com/
This is the first in a series of videos I want to do on Ansible. For the code and command I used in this video check out my blog post on thenathan.net
Pleas like, share and subscribe.