Skip to content

head0x49F/iac-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

##GCP+Terraform+Ansible

We will use Terraform for provisioning and orchestration, and Ansible for configuration and adding software. Requierements:

  1. Terraform
  2. Ansible
  3. Google Cloud SDK

First, be sure to run:

gcloud auth application-default login

so you don’t need set up GCP access manually.

Go to terraform folder and run:

terraform init
terraform apply

After creating all of your resources you can print the value for the static IP:

terraform output public_ip

And now you can use SSH to connect to the VM:

ssh -i .ssh/google_compute_engine <gcp-username>@<public_ip>

Now, go to ansible folder.

  1. Set ansible_host in inventory file (your public_ip).
  2. Specify remote_user (your gcp-username) in gcp_provision.yml 3.become parameter gives you superuser priveleges, so you need to specify name parameter at line 27 for adding your "gcp-username" to "docker" group.($USER won`t work, because $USER=root at that moment).
  3. Run:
ansible-playbook gcp_provision.yml

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages