Slide 1

Slide 1 text

Ansible and the Power of Google Cloud Platform Eric Johnson Program Manager, Google Compute Engine

Slide 2

Slide 2 text

Cloud Platform Agenda • Why Google? • Whirlwind tour of Google Cloud Platform • Introducing the new Ansible Modules

Slide 3

Slide 3 text

For the past 15 years, Google has been building out a massively fast, powerful, and reliable cloud infrastructure across the planet. Images by Connie Zhou

Slide 4

Slide 4 text

Cloud Platform Developing our infrastructure while respecting our ecosystem • Pioneering data center efficiency • Financed over 250 Megawatts of new wind power • First data centers to receive IOS 14001 certification • 100% carbon neutral

Slide 5

Slide 5 text

2002 2004 2006 2008 2010 2012 Colossus Dremel MapReduce Spanner Big Table GFS Driving Technology Forward Cloud Platform

Slide 6

Slide 6 text

Google Cloud Platform Storage Cloud Storage Cloud SQL Cloud Datastore Persistent Disk App Services BigQuery Cloud Endpoints Caching Queues Cloud Platform Compute App Engine Compute Engine

Slide 7

Slide 7 text

Cloud Platform • BLOB Storage, Immutable Objects • Strong read-after-write consistency • API and Web UI Accessible • Versioning • Static Sites, ACLs • Resumable Transfers • Object Change Notifications • Object lifecycle management Google Cloud Storage

Slide 8

Slide 8 text

• Fully managed, MySQL(like) • Ease of Use and Development • Highly Reliable • Flexible Charging • Security, Availability, Durability • EU and US Data Centers • Easy Migration & Data Portability • Control Cloud Platform Cloud SQL

Slide 9

Slide 9 text

Cloud Platform • Schemaless, Non-relational NoSQL Access • Auto-scale • Authentication That Just Works • Fast and Easy Provisioning • RESTful Endpoints • ACID Transactions • Query Language (akin to SQL) • Local Development Tools • Built-in Redundancy Cloud Datastore

Slide 10

Slide 10 text

Cloud Platform • Fully Managed Big Data Analytics Service • Fast • Scalable • Flexible and Familiar • Security and Reliability BigQuery

Slide 11

Slide 11 text

Cloud Platform • Fully Managed Platform • Easy Development & Deployment • Focus On Your Code Not Your Server • Automatic Scaling • Popular Programming Language Support • Services (Cron, Queue, Memcache, etc) • Datastore • Versioning and Traffic Splitting • Local Developer Tools • Third-party Frameworks and Extensions App Engine

Slide 12

Slide 12 text

Cloud Platform • Sub-hour Billing • Up to 10TB Persistent Disk • Over 64 Instance Types • Standard Linux Distributions • Advanced Networking • Instance Metadata and Startup Scripts • Load Balancing • Persistent Disks, snapshots • Fast and Easy Provisioning • Consistent Performance Google Compute Engine

Slide 13

Slide 13 text

Your instance here Images by Connie Zhou Google Compute Engine

Slide 14

Slide 14 text

Launching 100 VMs screencast in case of emergency Cloud Platform

Slide 15

Slide 15 text

Cloud Platform Compute Engine Cloud Storage Ansible

Slide 16

Slide 16 text

Cloud Platform New Ansible Modules New in Ansible 1.4(*) ● Google Compute Engine ○ gce - Instance (VM) management ○ gce_pd - Manage Persistent Disks ○ gce_net - Networks and Firewall Rules ○ gce_lb - Traffic Load-balancing of Instances ● Google Cloud Storage ○ gc_storage - Manage your Buckets and Objects (*) Depends on unreleased libcloud (0.14.0-beta1 coming soon)

Slide 17

Slide 17 text

Cloud Platform Module: gce Instance Management ● Create ○ Blocks until RUNNING ● Destroy ● Specifying instances ○ `name` for single instances ○ `instance_names` for >1 ● With/without PD boot disk Module Parameters: image instance_names machine_type metadata name network persistent_boot_disk state tags zone

Slide 18

Slide 18 text

Cloud Platform Inventory Plugin Instance Information ● Supports --host and --list ● Auth credentials in gce.ini ● Does *not* use a local cache --list categorizes instances by ● Zones, Machine Types, Networks, etc --host attributes: gce_description gce_id gce_image gce_machine_type gce_metadata gce_name gce_network gce_private_ip gce_public_ip gce_status gce_tags gce_uuid gce_zone

Slide 19

Slide 19 text

Cloud Platform Module: gce_pd Persistent Disk Management ● Unformatted Only ● Create, Destroy ● Attach / Detach ● RW / RO Module Parameters: detach_only instance_name mode name size_gb state zone

Slide 20

Slide 20 text

Cloud Platform Module: gce_net Networks and Firewalls ● Create / Destroy Networks ○ Networks are global ○ User defined network ranges ● Create / Destroy FW Rules ○ FW Rules require a network ○ Custom protocol/ports ○ Tags / ranges supported Module Parameters: allowed ipv4_range fwname name src_range src_tags state

Slide 21

Slide 21 text

Cloud Platform Module: gce_lb Manage Load-balancing ● Instance / member list ● Protocol / port range ● HTTP HealthChecking Module Parameters: httphealthcheck_name httphealthcheck_port httphealthcheck_path httphealthcheck_interval httphealthcheck_timeout httphealthcheck_unhealthy_count httphealthcheck_healthy_count httphealthcheck_host name protocol region external_ip port_range members state

Slide 22

Slide 22 text

Cloud Platform Module: gc_storage Google Cloud Storage ● Manage Buckets / Objects ● Upload / Download Objects ● Interoperable Mode ● Uses ‘boto’ library Module Parameters: bucket dest expiration force gcs_access_key gcs_secret_key mode object permission src

Slide 23

Slide 23 text

Cloud Platform Demo Time! Using the new Ansible GCE Modules, let’s build a trivial load-balanced web site ● Spin up two GCE instances ● Install Apache and custom index.html page ● Create a custom Health Check URL ● Create a Load Balancer and open up TCP:80

Slide 24

Slide 24 text

$ cat inv.ini [localhost] 127.0.0.1 [gce_instances] www1 www2 Cloud Platform Putting it all together... localhost inv.ini ------- gce.yml ------- Ansible + GCE www1 www2 Google API’s screencast in case of emergency

Slide 25

Slide 25 text

Cloud Platform Putting it all together... 1 - name: Create two new GCE instances 2 hosts: localhost 3 gather_facts: no 4 vars: 5 names: www1,www2 6 type: n1-standard-1 7 image: centos-6 8 zone: us-central1-a 9 tasks: 10 - name: Launch instances 11 local_action: gce instance_names={{ names }} machine_type={{ type }} 12 image={{ image }} zone={{ zone }} 13 register: gce 14 - name: Wait for SSH to be available 15 local_action: wait_for host={{ item.public_ip }} port=22 delay=3 16 timeout=9 state=started 17 with_items: gce.instance_data gce.yml, part 1: Create two GCE Instances

Slide 26

Slide 26 text

Cloud Platform Putting it all together... 1 - name: Install apache, set a custom index.html 2 hosts: gce_instances 3 sudo: yes 4 tasks: 5 - name: Install apache 6 yum: pkg=httpd state=present 7 - name: custom index.html 8 copy: dest=/var/www/html/index.html content='Hi, I am {{ ansible_hostname }}' 9 - name: set file stats on index.html 10 file: path=/var/www/html/index.html owner=root group=root mode=0644 11 - name: custom healthstatus 12 copy: dest=/var/www/html/isup.html content='ALIVE' 13 - name: set file stats on healthstatus 14 file: path=/var/www/html/isup.html owner=root group=root mode=0644 15 - name: start apache 16 service: name=httpd state=started gce.yml, part 2: Install Apache and Health Check URL

Slide 27

Slide 27 text

Cloud Platform Putting it all together... 1 - name: Create a firewall rule to allow HTTP 2 hosts: localhost 3 gather_facts: no 4 tasks: 5 - name: Allow HTTP 6 local_action: gce_net fwname=all-http name=default allowed=tcp:80 7 8 9 - name: Set up the load-balancer 10 hosts: localhost 11 gather_facts: no 12 tasks: 13 - name: Create LB 14 local_action: gce_lb httphealthcheck_name=hc httphealthcheck_path=/isup.html 15 name=lb region=us-central2 16 members=”{{ gce.zone }}/www1,{{ gce.zone }}/www2” gce.yml, part 3: Open TCP:80 and set up Loadbalancer

Slide 28

Slide 28 text

Cloud Platform And finally... Google + Ansible = Awesome! ● Use the platform and send us feedback ○ https://cloud.google.com/ ● Help improve Ansible+Google modules Thank you!