Showing posts with label DevOps. Show all posts
Showing posts with label DevOps. Show all posts

Monday, 18 June 2018

Working with Ansible

Consider the following terms while using Ansible.

Control Node
   
 Control host is a machine where we have installed the Ansible. This control host controls all remote nodes.

Managed hosts
    Remote nodes are named as managed hosts.

Inventory file
    This is the default ansible 'hosts' file. It is a collection of nodes with related datas and grouping that ansible can connect and manage.

Prerequisite:


1. Setup ssh key-based authentication. (Ansible is a agent-less tool and use SSH protocol to deploy modules on managed hosts.)

2. Install python on managed hosts

Setup ssh key-based authentication

Generate ssh key



copy ssh key file to managed hosts



checking auto login from control node to remote nodes.




Adding managed hosts in Inventory file

[root@sysads ~]# vim /etc/ansible/hosts

[servers]
10.177.6.249


Testing with ansible modules



Wednesday, 6 June 2018

Install Ansible on Ubuntu 16.04

Ansible is a IT automation, configuration management tool to manage the infrastructure. For more information click here
 
For installing Ansible you have to configure PPA on your machine.For this,you have to run the following commands

root@manivel:~# apt-add-repository ppa:ansible/ansible

 Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems.

http://ansible.com/
 More info: https://launchpad.net/~ansible/+archive/ubuntu/ansible
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmp7y79v8_4/secring.gpg' created
gpg: keyring `/tmp/tmp7y79v8_4/pubring.gpg' created
gpg: requesting key 7BB9C367 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp7y79v8_4/trustdb.gpg: trustdb created
gpg: key 7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK



root@manivel:~# apt-get update

root@manivel:~# apt-get install ansible


For checking Ansible version you have to run the following command

root@manivel:~# ansible --version

ansible 2.5.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/manivel/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Nov 20 2017, 18:23:56) [GCC 5.4.0 20160609]