Giter VIP home page Giter VIP logo

ansible-role-gce-config's Introduction

Ansible Role: Google Compute Engine

Configure Google Compute Engine

Cloud Provider:

cloud_provider:
  name: "gce"
  region: "europe-west1"
  zone: "europe-west1-d"
  project: "darkbulb-lab"
  cidr: "10.1.0.0/16"

Cloud Compute Instance:

cloud_compute:
  instance:
    jenkins-devops-victorock-io-000:
      name: jenkins-devops-victorock-io-000
      size: n1-standard-1
      image: centos-7
      credential:
        username: jdacosta
        key: jenkins-devops-victorock-io
      network:
        subnet: devops-victorock-io
        public: ephemeral
      tags:
        - jenkins

Cloud Network Subnet:

cloud_network:
  subnet:
    devops-victorock-io:
      name: devops-victorock-io
      cidr: "10.1.1.0/24"

Cloud Network Firewall:

cloud_network:
  firewall:
    devops-victorock-io-ssh-all:
      name: devops-victorock-io-ssh-all
      subnet: devops-victorock-io
      src_cidr: 0.0.0.0/0
      dst_port: 22
      proto: tcp

    devops-victorock-io-http-all:
      name: devops-victorock-io-http-all
      subnet: devops-victorock-io
      src_cidr: 0.0.0.0/0
      dst_port: 22
      proto: tcp

    devops-victorock-io-https-all:
      name: devops-victorock-io-https-all
      subnet: devops-victorock-io
      src_cidr: 0.0.0.0/0
      dst_port: 443
      proto: tcp

    devops-victorock-io-icmp-all:
      name: devops-victorock-io-icmp-all
      subnet: devops-victorock-io
      src_cidr: 0.0.0.0/0
      proto: icmp

Cloud Network Public:

cloud_network:
  public:
    jenkins-devops-victorock-io:
      name: jenkins-devops-victorock-io

Cloud Network Public:

cloud_network:
  loadbalance:
    http-jenkins-devops-victorock-io:
      name: http-jenkins-devops-victorock-io
      # Reference to Public Name
      public: jenkins-devops-victorock-io
      protocol: tcp
      port: 80
      members:
        # Reference to Instance
        - jenkins-devops-victorock-io-000
      healthcheck:
        name: http-jenkins-devops-victorock-io
        type: HTTP
        port: 80
        protocol: tcp
        url: "/"
    https-jenkins-devops-victorock-io:
      name: https-jenkins-devops-victorock-io
      public: jenkins-devops-victorock-io
      protocol: tcp
      port: 443
      members:
        # Reference to Instance Name
        - jenkins-devops-victorock-io-000
      healthcheck:
        name: https-jenkins-devops-victorock-io
        type: HTTPS
        port: 443
        protocol: tcp
        url: "/"

Cloud Network DNS:

cloud_network:
  dns:
    jenkins-devops-victorock-io:
      name: jenkins-devops-victorock-io
      # Reference to Public Name
      public: jenkins-devops-victorock-io
      zone: devops.victorock.io
      record: jenkins.devops.victorock.io

Cloud Storage Bucket:

NOTE: The gc_storage module requires interoperability keys Storage -> settings -> interoperability -> create new key

Example1: Multi-action

cloud_storage:
  bucket:
    darkbulb-image-store:
      name: darkbulb-image-store
      state: present
      actions:
        - mkdir: /files
          permission: private
          upload: /files/object.txt
          from: files/object.txt
          download: files/object.txt
          to: files/object_copy.txt
        - rm: /files/object.txt
        - rm: /files/

Example2: Unitary Actions

cloud_storage:
  bucket:
    darkbulb-image-store:
      name: darkbulb-image-store
      state: present
      actions:
        - mkdir: /files
          permission: private
        - upload: /files/object.txt
          from: files/object.txt
          permission: private
        - download: files/object.txt
          to: files/object_copy.txt
        - rm: /files/object.txt
        - rm: /files/

Example

Playbook: Instance Provisioning

---
- name: "Provision: Google Compute Engine"
  hosts: localhost
  connection: local
  gather_facts: false
  become: false

  tasks:
    - name: "victorock.gce_config"
      include_role:
        name: victorock.gce_config
        tasks_from: compute
      vars:
        cloud_compute:
          instance:
            jenkins-devops-victorock-io-000:
              name: jenkins-devops-victorock-io-000
              size: n1-standard-1
              image: centos-7
              credential:
                username: jdacosta
                key: jenkins-devops-victorock-io

Requirements

The following libraries are required by Ansible modules of this role:

  • apache-libcloud
  • boto3

License

GPLv3

Author Information

Victor da Costa

ansible-role-gce-config's People

Contributors

victorock avatar

Watchers

 avatar  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.