Setup node configuration
- create linux vm
- create ansible with password
- need provide sudo permissions
- python
sudo adduser ansible
# allow auth login with password
sudo nano /etc/ssh/sshd_config.d/10-password-login-for-special-user.conf
Match User ansible
PasswordAuthentication yes
## provide sudo permissions
sudo visudo
ansible ALL=(ALL:ALL) NOPASSWD:ALL
# restart sshd
sudo systemctl restart sshd
Test and validate connection
ansible -i <invetory file path> -m ping all --ask-pass
ANSIBLE_HOST_KEY_CHECKING=False ansible all -m ping --ask-pass
ANSIBLE_HOST_KEY_CHECKING=False ansible all -m ping -e "ansible_password=ansible"
Flags
-i hots-> inventory file path (node details)
EX:
echo "localhost" > local-machine.host
echo "54.82.66.253" >> local-machine.host
ANSIBLE_HOST_KEY_CHECKING=False ansible -i local-machine.host all -m ping -e "ansible_password=ansible"
-
-m ping–> inbuild ping module (test connection) -
all–> Target all server in inventory -
--ask-pass–> Get pront ask password node when connect -
-e "ansible_password=ansible"–> provide password.
generate sshkey and copy nodes
ssh-keygen
ssh-copy-id ansible@172.31.31.199
validate login without password
ssh ansible@172.31.31.199
sample website deployment manually
sudo apt update
sudo apt install apache2 -y
sudo apt install unzip -y
wget https://templatemo.com/tm-zip-files-2020/templatemo_629_nexus_system.zip
unzip templatemo_629_nexus_system.zip
ls templatemo_629_nexus_system
sudo cp -rf templatemo_629_nexus_system/* /var/www/html/
cd /var/www/html/
sudo systemctl restart apache2
sudo systemctl status apache2
Task:
create linux and install above step in nginx server. (ubuntu and redhat)
