Ansible
Ansible
======================
************************
======================
1)sudo su===>Change to root
2)Whoami==>To check the User
3)python –version==>To check the python version in master
4)yum install ansible==>To install ansible
(or)
sudo amazon-linux-extras install ansible2 ==>for amazon-linux
5)ansible - -version==>To check the version of ansible
6)useradd ansible
7)passwd ansible
8)visudo==>without a passwd=>ansible ALL=(ALL) NOPASSWD: ALL
9)vim /etc/ssh/sshd_config==>Enable passwordAuthentication
10)service sshd status
11)service sshd restart
12)su – ansible
13)pwd===>(/home/ansible)
14)ssh-keygen==>Hit enter for everything
15)cd .ssh==>((id-rsa id_rsa.pub))
16)ssh-copy-id 13.233.128.22==>Establish connection between master and client
(it will generate know_hosts it contains key)
17)cd /etc/ansible/==>
ansible.cfg==>main configuration file
hosts==>Inventory file
roles(d)
18) sudo vim hosts=>copy client ip address
Group of Groups
============
[ggroup:children]
group1
group2
group3
structure of playbook
==================
---
- hosts: all
become: yes
tasks:
- yum: name=php state=present
- yum: name=java state=present