Ansible Tutorial - Give Sudo Privileges | SSH Connection to Nodes

preview_player
Показать описание
Ansible Tutorial - Give Sudo Privileges | SSH Connection to Nodes
#Devops #DevopsTools

Now will Move to Ansible...

How to install ansible and how to connect server to nodes
How to give permission to nodes (installing and uninstalling)
How to give sudo permission /stop

Let's do upto this....

1.First launch 3 Ec2 machines
named as ansible server
ansible node1
ansible node2
2.Now login to all machines and install ansible in ansible server machine only
(No need to install in ansible node1 and 2)
yum install wget -y
yum update -y


sudo yum update -y
sudo yum install git python python-devel python-pip openssl ansible -y
Now check the ansible
Now create ansible user and password (in all machines...)
adduser ansible
passwd ansible (password set whatever you want...i have updated manytimes no need to do like this)
now i will do this in both nodes. Done.

Now goto visudo here we are adding ansible user in sudo list.
and add this under root command (In all machines)
ansible ALL = (ALL) NOPASSWD: ALL
like the same as what we see in the above command.

3.To establish ssh connection in all node do this in all machines.
vi /etc/ssh/sshd_config
PermitRootLogin yes (un comment set to yes)
PasswordAuthentication yes (uncomment set to yes)

Now service sshd restart

check the sudo asking without password or not...in server
Now
ssh private ip of node. it is asking password so we will give public key
and private key to all nodes.
ssh-keygen --- be in ansible user(can see .ssh and both keys in same directory)

4.Now host the patterns (run in server)
vi /etc/ansible/hosts
Now run this command
ansible all --list-hosts this means we have added nodes as hosts in server.
give name demo to the hosts
ansible demo --list-hosts

by using the above command we see the hosts by giving index.
we can see from range also
ansible demo[0:1] --list-hosts

It's done upto now...
Thanks for watching...Let's subscribe for more intresting devops videos...

Ansible Gather Facts - Ansible Variable,Loops,When Condition | Ansible Tutorial for Beginners Part-3 HD
#Devops - Ansible Playbook - Ansible Tutorial for Beginners Part-3
#AnsibleTutorial

Ansible Ad hoc Commands - Ansible All Modules | Ansible Package Modules | Ansible Tutorial Part - 2
#Devops #Ansible Ad hoc Commands - Ansible Tutorial Part - 2
#AnsibleTutorial

How to Install Ansible - Give Sudo Privileges | SSH Connection to Nodes - Ansible Tutorial part - 1
#Devops - Ansible Playbook - Ansible Tutorial for Beginners Part-1
#AnsibleTutorial

Will see in ansible part 2 video....
Рекомендации по теме