How to Create a Server in AWS?
How to get into the server?
How to Create users in linux?
Make normal users as sudoer Ssh password authentication?
CM
Ansible :
We can execute any linux commands
$ sudo -i
# apt-get update
# apt-get install apache2 ( it is web sever)
# adduser sagar ( sagar is normal user)
# su sagar
$ cd
$ pwd
$ touch f1 f2 f3
$ ls
$ ls -la
$ mkdir myfolder
$ ls
$ apt-get install apache2
I want to install apache2 by sagar user.
By making suuser as sagar, by giving root privilege to sagar
# visudo
sagar ALL=(ALL) NOPASSWD: ALL
Ctr+x , press y , press enter
# su sagar
# sudo apt-get install apache2
Passwordless Authentication?
Configure master server
Create a Aws ubuntu 18 server with t2.micro
Add sagar user
# adduser sagar
- Make sagar user as sudoer
# visudo
sagar ALL=(ALL) NOPASSWD: ALL
ctr+x, press y and enter
- Passwd authentication( with passwd without pem )
# vi /etc/ssh/sshd_config
Passwd authentication yes
Shift+:wq
- Restart ssh service
# service ssh restart
Configure Node servers
Create a Aws ubuntu 18 server with t2.micro
Add sagar user
# adduser sagar
- Make sagar user as sudoer
# visudo
sagar ALL=(ALL) NOPASSWD: ALL
ctr+x, press y and enter
- Passwd authentication( with passwd without pem )
# vi /etc/ssh/sshd_config
Passwd authentication yes
Shift+:wq
- Restart ssh service
# service ssh restart
Communication master server to nodes server without passwd ON MASTER SERVER as Sagar User
su sagar
$ cd
$ pwd
$ ssh-keygen ( by this command , will generate private and public key)
$ ssh-copy-id <private ip of nodes>
$ ssh <private ip of nodes>
( without pem and passwd , we can able to connect master into nodes)
CM:
Ansible: PUSH Model
Install and configure ansible master
Create aws ubuntu 18 server
Add ansible user
# adduser maha
- Make ansible user as sudoer
# visudo
Maha ALL=(ALL) NOPASSWD: ALL
Ctr+x, press y and enter
- Passwd authentication( with passwd without pem)
# vi /etc/ssh/sshd_config
Passwd authentication yes
Shift:wq and enter
- Restart ssh service
# service ssh restart
- Install ansible
# sudo apt-add-repository ppa:ansible/ansible
# sudo apt update
# sudo apt install ansible
# ansible --version
Configure ansible nodes
Create aws ubuntu 18 server
Add ansible user
# adduser maha
- Make ansible user as suduser
# visudo
Maha ALL=(ALL) NOPASSWD: ALL
Ctr+x, press y and enter
- Passwd authentication( with passwd without pem)
# vi /etc/ssh/sshd_config
Passwd authentication yes
Shift:wq and enter
- Restart ssh service
# service ssh restart
Don’t Install ansible
# sudo apt-add-repository ppa:ansible/ansible
# sudo apt update
# sudo apt install ansible
# ansible --version
Connect ansible master to ansible nodes without passwd ON ANSIBLE MASTER as Ansible user as maha
su maha
$ cd
$ pwd
$ ssh-keygen
$ ssh-copy-id <private ip of ansible node>
$ vi myhost
<private ip of ansible node1>
<private ip of ansible node2>
<private ip of ansible node100>
:wq!
- ansible all -i myhost -m ping