Ansible:
Ansible is open-source IT tool for automation (Redhat)
Where ansible will be used:
- configuration managment -> Install, upgrade and manage files and services
- Application deploymnet -> Deploy code access multiple sites
- Orchestration: used deploy micro services
- provisioning: Setup infra (vms, cloud resources)
Key Points:
- Agentless – NO softwares are required to install
- yaml-based- files will be human readable
- pushbased – control machine will connect to nodes directly
- idempotent – we can run twice or more the result will be same.
Install ansible
offical docs for ansible installtion
sudo su - # sudo perrmission to become root user
sudo adduser ansible # create ansible user
sudo nano /etc/ssh/sshd_config.d/10-password-login-for-special-user.conf ## allow user to login ssh with password
Match User ansible
PasswordAuthentication yes
sudo systemctl restart ssh
sudo systemctl restart sshd
# ubuntu
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
ansible --version ## Verify ansible server version
Default paths:
- inventory -> /etc/ansible/hosts
- roles -> /etc/ansible/roles
- /usr/bin/ansible -> binary path
- /etc/ansible/ansible.cfg -> main configuration file
- temp – ~/.ansible/temp
Create keypair and copy to ansible user
ssh-keygen
ssh-copy-id user@ipaddress
ssh-copy-id ansible@localhost
# sudo permissions to user
sudo visudo
ansible ALL=(ALL:ALL) NOPASSWD:ALL
ssh ansible@ipaddress
sudo su -
Task
- setup ansible server and create node install python and create ansible user
- generate ssh-key in ansible server and copy key node.
