cloud,

Ansible for VMware

Follow · 1 min read
Share this

VM Migration: Planning

terraform -v

git clone https://github.com/morgante/terraform-codelab.git cd terraform-codelab/lab-networking

edit terraform.tfvars -> open editor project_id=”qwiklabs-gcp-01-eb85e88d83fc”

gcloud iam service-accounts create terraform –display-name terraform

gcloud iam service-accounts list

gcloud iam service-accounts keys create ./credentials.json –iam-account terraform@qwiklabs-gcp-01-eb85e88d83fc.iam.gserviceaccount.com

gcloud projects add-iam-policy-binding qwiklabs-gcp-01-eb85e88d83fc –member=serviceAccount:terraform@qwiklabs-gcp-01-eb85e88d83fc.iam.gserviceaccount.com –role=roles/owner

— setup remote state

gsutil mb gs://qwiklabs-gcp-01-eb85e88d83fc-state-bucket

– edit backend.tf

terraform { backend “gcs” { bucket = “qwiklabs-gcp-01-eb85e88d83fc-state-bucket” # Change this to -state-bucket prefix = "terraform/lab/network" } }

— run terraform

terraform init

terraform plan

terraform apply

terraform show

– add a subnet

edit network.tf

# # Create the network
module "vpc" {
  source  = "terraform-google-modules/network/google"
  version = "~> 0.4.0"

  # Give the network a name and project
  project_id   = "${google_project_service.compute.project}"
  network_name = "my-custom-network"

  subnets = [
    {
      # Creates your first subnet in us-west1 and defines a range for it
      subnet_name   = "my-first-subnet"
      subnet_ip     = "10.10.10.0/24"
      subnet_region = "us-west1"
    },
    {
      # Creates a dedicated subnet for GKE
      subnet_name   = "my-gke-subnet"
      subnet_ip     = "10.10.20.0/24"
      subnet_region = "us-west1"
    },
    # Add your subnet here
  ]

  # Define secondary ranges for each of your subnets
  secondary_ranges = {
    my-first-subnet = []

    my-gke-subnet = [
      {
        # Define a secondary range for Kubernetes pods to use
        range_name    = "my-gke-pods-range"
        ip_cidr_range = "192.168.64.0/24"
      },
    ]
    # Add your subnet’s secondary range below this line.

  }
}

terraform apply

Latest Stories

How To Get Hands-On Experience in AWS

Every Time you have the same situation, you know the technology and maybe you are already a certified professional in that technology, but you are not getting enough hands-on on that ...

In AWS, Jan 04, 2021
Getting Started with Ansible Collections

Ansible Collection is a great way of getting content contributions from various Ansible Developers. Earlier there was a tagline for Ansible – “Batteries included”, but now the battery...

In redhat, ansible, Dec 22, 2020
Configure Your Windows Host to be Managed by Ansible

I was talking to my friend about Ansible automation and how we are implementing automated solutions for cloud and on-premise infrastructure. Then he told me that, his team is looking ...

In redhat, ansible, Dec 01, 2020
Remove nodes from Kubespray Managed Kubernetes Cluster

Kubespray is a combination of Ansible and Kubernetes and you can use Kubespray for deploying production ready Kubernetes clusters. You can manage full-lifecycle of Kubernetes clusters...

In containers, kubernetes, Nov 30, 2020
Adding new nodes to Kubespray Managed Kubernetes Cluster

Kubespray is a combination of Ansible and Kubernetes and you can use Kubespray for deploying production ready Kubernetes clusters. Learn how to add new nodes in a Kubernetes cluster u...

In containers, kubernetes, Nov 27, 2020

Featured