Git Product home page Git Product logo

terraform-ansible-gcp's Introduction

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

terraform-ansible-gcp's People

Contributors

tapanbanker avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.