U1.23 Ubuntu Quick Start (QS): Ansible basic inventory - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

Preliminary steps

  • Consult the article U1.22

Creations steps

Reminder:

  • 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

Creation of inventory:

  • 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

test the inventory settings:

  • 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.
sudo ansible all -m ping
ansible all -m ping
  • Here is a result
Click to show the picture

picture

  • disable ufw and repeat
    • run the commands
sudo ufw status
sudo ufw disable
sudo ufw status
Click to show the picture

picture

  • If to repeat ansible all -m ping
    • we still get ** Failed to connect ... ** exception

Installing openssh-server:

  • 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

picture

Generate and copy SSH Key

ssh-keygen
ssh-copy-id 192.168.100.8
Click to show the picture

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
sudo ansible all -m ping
ansible all -m ping
Click to show the picture

picture

⚠️ **GitHub.com Fallback** ⚠️