Software deployment is always complex due to different OS existence and dependencies. Ansible is simple IT automation system, configuration management and provisioning tool. Let's assume that you have just deployed your application to server. And, you have quiet big infrastructure with many WAS, DB and load balancer nodes. And if you are responsible for managing servers you could handle all these server management tasks easily with this tool without manual SSH access to server and do all by hand. All you need is Ansible.
Why we need to use configuration management tool at all?
Installation is simple on OSX. If you are using Homebrew you can install it:
$ brew update $ brew install ansible
Inventory file #
Inventory file must contain list of hostnames and IP addresses on each line. For example:
10.0.1.1 mongo_node_111.intranet.insilicogen.com 10.0.1.2 mongo_node_112.intranet.insilicogen.com 10.0.1.3 mongo_node_113.intranet.insilicogen.com 10.0.1.4 mongo_node_114.intranet.insilicogen.com 10.0.1.254 firewall_node_0.intranet.insilicogen.com 10.0.1.88 lb_master.intranet.insilicogen.com
By default, Ansible looks for an inventory file at
Let’s verify we have everything setup correctly and we can connect to our host(s).
$ ansible all --inventory-file=insilicogen.hosts --module-name ping -u root
There is a large catalog of modules available for Ansible out of the box. Here are just a very small sample of some things that can be managed with Ansible modules:
- apache modules
- firewall rules
- ruby gems
- git repositories
- mysql and postgresql databases
- docker images
- AWS / Rackspace / Digital Ocean instances
- Campfire or Slack notifications
and a whole lot more.
Playbooks allow you to organize your configuration and management tasks in simple, human-readable files. Each playbook contains a list of tasks (‘plays’ in Ansible parlance) and are defined in a YAML file.