SSH & Ansible
Terminology
VM : Virtual machine
Host : Controller
Guest/remote : Client machine
SSH : Secure Shell
Inventory file: A text file that stores nodes' info
Prerequisites
1. At least 2 vms running
2. Any text editor
3. Terminal (coz it's awesome)
What is SSH?
A service that allows very strong authentication and encrypted data communication.
Let's start
1. Install openssh-client in remotes and Install openssh-server in the host
$sudo dnf install -y openssh-server
$sudo dnf install -y openssh-client
2. Enable and start the services
$sudo systemctl enable sshd
$sudo systemctl start sshd
...keep going...
4. Create public and private keys
$sudo ssh-keygen
5. login remote from host by
$sudo ssh root@192.168.X.X //ip address of remote
6. Exit and copy your public to remote
$sudo ssh-copy-id root@<ip>
7. Try to login again, If everything worked fine, it should not ask for password.
What is Ansible?
A software that enables us to deploy any application on multiple computers at once.
Agentless
Easy to use
Intelligent automation system
Need not be installed on client machines
Open Source
Ansible is...
Its major functions
Change Management
Automation
Provisioning
Orchestration
Let's install Ansible
1. Install ansible on controller
$sudo dnf install -y ansible
on the path..
- ansible's config file can be found in /etc/ansible
- Inventory file is stored in /etc/ansible/hosts
- Go to the end of file, and make a group of nodes.
on the path..
An example of group
[web-servers]
192.168.X.X
192.168.X.X
You can add any number of guests
Test your connection.
#ansible -m ping amrita
Hack on
#ansible -m command -a "uptime" amrita
Playbooks
Playbooks are Ansible’s
- configuration
- deployment
- orchestration
language.
They describe the change you want.
On a basic level, They are Used to manage configurations of and deployments to remote machines.
Playbooks
At a more advanced level, they can sequence multi-tier rollouts involving rolling updates, and can delegate actions to other hosts, interacting with monitoring servers and load balancers along the way.
Playbooks
At a more advanced level, they can sequence multi-tier rollouts involving rolling updates, and can delegate actions to other hosts, interacting with monitoring servers and load balancers along the way.
Ansible
By Vipul Siddharth
Ansible
- 366