Anisble demo and how to connect using ssh.
1 . Install ( extra package of Enterprise)
wget <https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm>
2 . install epel packaged
-
apt install update
yum/apt install epel
-
install collection of give below package
apt install git python python-level python-pip openssl ansible
- configure ansible host
vi /etc/ansible/hosts
- edit and add group and add private IP Address
Group_Name IP-Address
[demo] 172.31.41.240
- Configure main file in anisble
vi /etc/ansible/ansible.cfg
adduser ansible (optional)
- Give sudo rights using command
visudo
- All root to run any command anywhere change
username ALL=(ALL) NOPASSWD: ALL using below command
ansible ALL=(ALL) NOPASSWD: ALL
- Ansible user login
su - ansible
- configure SSH
vi /etc/ssh/sshd_config
- Take SSH Connection
ssh [Private_IP]
- If Permission denied do this : -
service sshd restart
generate key because every time need password ( make trust Relation Ship )
Notes : You need to same user anisble & root
ssh-keygen
cd .ssh
ls
- Copy a file to node
ssh-copy-id ansible@NodePrivateIP
Host Patterner : How to Identify host for individual update
ansible all —list-hosts
ansible [group-name] —list-hosts
ansible [group_name][index_no] --list-hosts
ansible [group_name][rangeofnode:rangeofnode] --list-hosts
ansible [group_name][2:6] --list-hosts
ansible [group_name][1:6]:[unother-group_name][4:6]
For Better view Visit my Notion Site
https://www.notion.so/Ansible-Configuration-a4fd1725c7fc4fdfaa3da23144f03a19
Comments