Skip to content

Instantly share code, notes, and snippets.

@dmccuk
Last active February 25, 2022 09:56
Show Gist options
  • Select an option

  • Save dmccuk/5fe9991f65f68a4c470250f2df30bc13 to your computer and use it in GitHub Desktop.

Select an option

Save dmccuk/5fe9991f65f68a4c470250f2df30bc13 to your computer and use it in GitHub Desktop.

Cloud shell

Free VM playgroud

Subscribe To Me On YouTube: https://bit.ly/lon_sub

If you're looking for a FREE environment for testing your code against, Have you heard about Google cloud shell??

If you have a gmail account, you get FREE access to you're own VM.

Please click the **Subscribe** button. I really appreciate it!

Each VM comes with 5GB of storage space and on my VM, 8GB RAM.

Everything will be done in the browser - chrome.

  • No VirtualBoX
  • no cloud VMs

Great Ansible Course: James Spurin - https://www.udemy.com/course/diveintoansible/

LINKS:

https://cloud.google.com/shell/docs/how-cloud-shell-works https://cloud.google.com/shell/docs/limitations

Subscribe - Thank you.

Before I start the Demo, if you like this kind of content, help me by pressing the subscribe button - Thanks!

Todays Demo:

It's a complete playground environment

URL: https://diveinto.com/p/playground

  • run all the commands in the readme doc on the right hand side.

  • When you get the docker-compose up, nohup the process.

    • This sends it to the background.
    • Why? Because there is a timeout with GCS that will disconnect you.
    • To get round this, nohup the compose command, then run a watch df, or your favorite command that will keep the session active.

Once your cloud chell environment is up and running:

  • ON the control node: C- node

to get the environment setup:

mkdir ansible
cd ansible
vi ansible.cfg

[defaults]
host_key_checking = false

vi hosts.ini
ubuntu1
ubuntu2
ubuntu3
centos1
centos2
centos3

AnsibleCLI: ansible -i hosts.ini all -m shell -a 'uptime'

For Loop: for i in `cat hosts.ini`; do echo $i; ssh $i uptime; done

Thats it!

You now have a control now with SSH & Root access to 6 VMS (3 x centos & 3 x ubuntu) you are up and running and all set!!

Shutdown and restart

Watch me shut the cloud shell session down and restart it to prove your work is saved.

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment