U1.23 Ubuntu Quick Start (QS): Ansible basic inventory - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki
- Consult the article U1.22
-
we have three virtual machines with the following ip addresses:
- u200401=192.168.100.8
- u200402=192.168.100.9
- u200403=192.168.100.10
-
Step 13: for u200401 machine ONLY
- run the command
sudo mkdir /etc/ansible
-
Step 14: for u200401 machine ONLY
- run the command
sudo nano /etc/ansible/hosts
- insert only one ip-address -- the address of the current machine
- save the file
192.168.100.8
-
Step 15: for u200401 machine ONLY
- run the commands (with and without sudo prefix)
- the first command will be available if ansible is installed globally.
- run the commands (with and without sudo prefix)
sudo ansible all -m ping
ansible all -m ping
- Here is a result
Click to show the picture
- disable ufw and repeat
- run the commands
sudo ufw status
sudo ufw disable
sudo ufw status
Click to show the picture
- If to repeat ansible all -m ping
- we still get ** Failed to connect ... ** exception
- to install openssh-server server
- run the commands
sudo apt install openssh-server
sudo systemctl status sshd
- After repeating ansible all -m ping
- the output changed
- but this is still an exception
Click to show the picture
- read the article Ssh-copy-id for copying SSH keys to servers
- run the commands
- Note: no sudo prefix for the commands
- Note: we use the user who is currently logged in (i.e. not a root)
ssh-keygen
ssh-copy-id 192.168.100.8
Click to show the picture
- make a test
- run the commands (with and without sudo prefix)
- the first command will be available if ansible is installed globally. in any case it will print error
- run the commands (with and without sudo prefix)
sudo ansible all -m ping
ansible all -m ping