Notes and files required for IOTA Ansible demo.
https://github.com/mmumshad/simple-webapp (Somebody had very conveniently created it for Ansible testing!)
Go to Compute Engine (VM instances)
Instance 1:
- name: ansible-controller
- Operating system: Ubuntu 18.04 LTS (Under Boot Disk section)
- Check Allow HTTP traffic (Under Firewall section)
- Network: default
Instance 2:
- name: ansible-host Rest same as Instance 1
- Go to Compute Engine (VPC networks)
- Click on "default"
- Scroll and go to firewall rules section
- Add firewall rule with the following config:
- name: allow-5000
- Target: All instances in the network
- Source IP range: 0.0.0.0/0
- Under Port and Protocols:
- Check tcp and allow 5000
- name: allow-5000
- Click on create
This will open port 5000 for all the instances in the "default" network.
This step has to be done in both the instances. First SSH into the desired instance (Look at HOW TO SSH section). Follow the steps in this link (Only step 1): https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-ansible-on-ubuntu-18-04
Check: ansible --version
should return the version number in the first line.
https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-18-04-quickstart No need to setup configs
This is a little advanced ( I will be explaining this in the session if you don't follow ). For now just follow the instructions.
SSH into ansible-controller
sudo su - ubuntu
ssh-keygen
(keep pressing enter till you see some weird patterns!)cat ~/.ssh/id_rsa.pub
(copy the contents somewhere)
- Click on ansible-host
- Go to SSH Keys section
- Put the copied public key under this section (you should see "ubuntu" on the left side after a short delay)
Now, if you SSH into ansible-controller and do ssh ansible-host
from there, you should be in the host machine.
Update: try ssh <ansible host private IP>
if the above step doesn't work.
Go to Compute Engine (VM instances)
- Click on the instance you want to SSH into.
- Click on the small downward arrow next to SSH
- View gcloud command
- Click on RUN IN CLOUD SHELL. This will launch a Cloud Shell and automatically put you inside the desired instance (ansible-controller or ansible-host, whichever is desired)