Installing and Configuring Ansible
- We will create two ubuntu vms
- Create a user called devops in two vms with sudo permissions
- Create a key-pair in ansible control node & copy the public key to other vm from ansible control node
- Installing ansible
sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
- Verify ansible version
- Now lets add inventory. Create a file called as
hosts
with one entry<ipaddress>
- Check connectivity by executing
ansible -m ping -i hosts all
- Note:
- To enable password authentications edit config
/etc/ssh/sshd_config
and set PasswordAuthentication to yes from no - restart sshd service
sudo service sshd restart
- To enable password authentications edit config
Linux Topics
- User management
- sudo
- key management (ssh-keygen, ssh-copy-id)
- package management (apt, yum, dnf)
- file editing (nano, vim)