8000 GitHub - tapanbanker/terraform-ansible-gcp: Automation with Terraform, Ansible on Google Cloud Platform (GCP)
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Automation with Terraform, Ansible on Google Cloud Platform (GCP)

License

Notifications You must be signed in to change notification settings

tapanbanker/terraform-ansible-gcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automation with Terraform, Ansible on Google Cloud Platform (GCP)

  • Terraform and Anisble DevOps deployment
  • Deploying Google GCP Virtual Network, Subnet, 2 GCP Instance with Google Load Balancer by Terraform. The Ansible with Terraform will install PHP, NGNIX and REDIS.

Deployment

Pre-requisite

Create GCP a service account

  • In the Cloud Console, go to the Create service account key page. Go to the Create Service Account Key page
  • From the Service account list, select New service account. In the Service account name field, enter a name. From the Role list, select Project > Owner.
  • Download the JSON file. Rename the JSON file as key.json and put in the project directory.
  • Use the following link - https://cloud.google.com/docs/authentication/production

How to Execute

  • Perform the Git clone
cd terraform-ansible-gcp
  • Update the terraform.tfvars file. Update the 'project_id' with the GCP Project ID Project ID
  • Perform following commands to authenticate GCP.
  • Recommend to use us-east-1 region and us-east-1b as zone.
  • Select the project and the email address.
glcoud init 
  • Execute following Terraform commands
terraform init
terraform plan
terraform apply
  • Wait for 3-4 minutes for the terraform and ansible to execute.
  • Check the Google Cloud Platform console.

Google Cloud Platform

Technical Description

  • The template is using Terraform with Ansible
  • The Google Cloud Platform GCP resource type is used as provider.
  • There are local variable and also we are using data source, check the main.tf (google_project)
  • The data source allow us to check if not exisit, or not.
  • The terraform templates creates 2 managed instance groups that can use autoscaling.
  • The port 80 and 443 are open through the Google Load Balancer
  • The module for PHP, Redis, Google Load Balancer
  • The Ansible Playbook will install the PHP and NGNIX in one GCP Compute Engine
  • The Anisble Playbook will install Redis on another GCP Compute Engine.
  • Nginx is exposed to Internet via google load balancer.
  • The Ansible Playbook is triggered by Terraform using cloud-config
  • The Anisble Playbook utilize Google Cloud Storage
  • There are task in the Ansible playbook and marked with tags (Intall PHP, Install Apache, Start NGNIX, REDIS)
  • After login into the GCP Compute by SSH execute following commands to verify the PHP, NGNIX and redis installation by Ansible
  • On the PHP GCP Compute Engine
 php -v
 ngnix -v 
  • On the Redis GCP Compute Engine
redis-server --version

About

Automation with Terraform, Ansible on Google Cloud Platform (GCP)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0