Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Ansible + GCP
Rating: 4.3 out of 5(62 ratings)
4,089 students

Ansible + GCP

An introduction to Ansible with GCP
Created byRohit Abraham
Last updated 4/2021
English

What you'll learn

  • GCP with ansible for beginners

Course content

1 section6 lectures51m total length
  • An introduction to Ansible13:15

    A brief overview of Ansible .

    How to create a playbook

    Important Links Ansible installation


    https://docs.ansible.com/ansible/latest/installation_guide/index.html

    Google Module for Ansible Installation https://docs.ansible.com/ansible/latest/scenario_guides/guide_gce.html


    Link to Cloud function Code Snippet https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp_cloudfunctions_cloud_function_module.html

  • Create an instance in GCP using ansible and gcloud CLI4:28
  • Create GCP instance using Ansible and Google provided ansible Module10:19

    Here we discuss how to create a GCP instance using Ansible provided module


    For most commonly used ansible module :

    https://dzone.com/articles/10-easy-to-use-modules-in-ansible-1


    The collection of Google provided ansible module

    https://galaxy.ansible.com/google/cloud

    -------PLAYBOOK--------------------


    - name: Create an instance

      hosts: localhost

      gather_facts: no

      vars:

          gcp_project: valiant-hangout-310414

          gcp_cred_kind: serviceaccount

          gcp_cred_file: /home/admin_/valiant-hangout-310414-08d733642027.json

          zone: "us-central1-a"

          region: "us-central1"


      tasks:

       - name: create a disk

         gcp_compute_disk:

             name: 'disk-instance'

             size_gb: 50

             source_image: 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts'

             zone: "{{ zone }}"

             project: "{{ gcp_project }}"

             auth_kind: "{{ gcp_cred_kind }}"

             service_account_file: "{{ gcp_cred_file }}"

             scopes:

               - https://www.googleapis.com/auth/compute

             state: present

         register: disk

       - name: create a address

         gcp_compute_address:

             name: 'address-instance'

             region: "{{ region }}"

             project: "{{ gcp_project }}"

             auth_kind: "{{ gcp_cred_kind }}"

             service_account_file: "{{ gcp_cred_file }}"

             scopes:

               - https://www.googleapis.com/auth/compute

             state: present

         register: address

  • AnsibleCreate Inventory File10:21

    How to create an inventory file to connect to your instances in GCP


    Documentation on how to create an inventory file is given in the link below

    https://docs.ansible.com/ansible/latest/scenario_guides/guide_gce.html



    Also to create groups for your inventory file please go through the below link

    http://matthieure.me/2018/12/31/ansible_inventory_plugin.html

  • Create a sample Architecture using Ansible5:42

    In this demo, we will see how to create a simple playbook that will create 2 instances in GCP and upload an apache and an Nginx server in those instance

    Github link to the code

    https://github.com/rohitabraham02/ansible-1.git

  • Roles in Ansible7:32

    In this demo we will discuss how to create roles in Ansible .


    For more information about roles please do check out


    https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html



    GIT URL

    https://github.com/rohitabraham02/ansible-role



    Galaxy URL

    https://galaxy.ansible.com/

Requirements

  • Basic knowledge about GCP and ansible

Description

This is an introductory course on how to use Ansible with Google Cloud .In this course i have used cloud shell to demonstrate all my example .

To get the best out of this course you need to have

1.A basic introduction to GCP .

2.A service account with relevent permissions

3.GCP Console along with cloud shell  (if you do not wish to use cloud shell you can use any linux distro with gcloud cli installed )

4.An basic understanding of Ansible

5.Ansible Galaxy and gihub for role creation


What is Ansible ?

Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs.


In this course we will be using the power of Ansible to create infrastructure in GCP 


I will be covering the following topics in this course


1. A brief introduction to Ansible

2.Create an instance using Gcloud CLI

3.Create an instance using Google Module

4.Create a simple Architecture

5.Inventory system in GCP

6. Roles and creating a Role and uploading it to Ansible Galaxy and using the role in code


Also please do check out my other courses in udemy


Please do not forget to review my course and happy learning



Thanks in advance

Who this course is for:

  • Beginner DEvops