Google Cloud Platform Blog
Product updates, customer stories, and tips and tricks on Google Cloud Platform
Using Ansible to Automate Google Compute Engine
Monday, May 5, 2014
Today's guest post comes from Michael Dehaan, the original author of Ansible and CTO of Ansible, Inc.
Ansible
is an easy to use IT automation platform that provides the ability to deploy applications, configure systems, and orchestrate complex workflows. Ansible has had support for Google Cloud Platform for about a year, and we’d like to share a bit of information about how to use it.
Examples are available in our
Google Cloud Platform Guide
-- as well as several “gc” prefixed modules in our
Cloud Module Index
.
Users have a lot of choices in picking how they want to manage their cloud infrastructure. When automating in the cloud, some of the most important things to consider are dealing with the challenges of the management stack itself, and how the management stack interacts and scales as the nature of cloud deployments increase in complexity. Not only do you need a system that is easy to maintain, but also a system where the automation content is easy to write and evolve.
Ansible is designed around SSH because SSH is cloud native -- which works well with Google Cloud Platform in many ways.
By using SSH to manage your nodes, there are no additional daemons to install, or security packages to manage. SSH keys can be easily injected upon virtual machine instantiation. No additional resources are consumed on remote nodes, and there’s never the problem of a management agent “falling over” and the user not having a way to automate the box. There are no additional open ports, and when a box is not being managed by Ansible, nothing extra is running. Ansible enables this not by logging into your boxes and running commands, but by connecting to them over SSH to transfer modules, run them, and parse out responses. It then cleans up after itself leaving nothing behind but logs.
One of Ansible’s main focuses is around application deployment of complex multi-tier applications. This includes not only cloud provisioning (as illustrated in the Compute Engine guide) but also working with zero-downtime rolling updates involving load-balanced infrastructure -- which there is also an Ansible module for the
Compute Engine Load-Balancer
. Instances can either be updated in place, or new machines can be spun up and added to load balancers while others are spun down. Additionally storage and networking can be worked with as well.
Another way that Ansible integrates with Compute Engine, also as documented in the
Google Cloud Platform Guide
, is the ability to query inventory dynamically from the Google cloud. In getting the most out of cloud, it’s important to treat instances as cattle, not pets. Having groups of machines sorted by tag, rather than instance hostnames, greatly decreases management complexity as scale changes.
If you’d like to find out more about Ansible generally, see
docs.ansible.com
, and also explore some of the community roles found at
galaxy.ansible.com
. Ansible Galaxy is a site where users can create and share automation roles with each other, which can help jumpstart new deployments.
If you have specific questions about Ansible and Compute Engine, you may wish to join the
Ansible Project Google Group
.
-Contributed by Michael DeHaan, original author of Ansible, and CTO of Ansible, Inc.
Free Trial
GCP Blogs
Big Data & Machine Learning
Kubernetes
GCP Japan Blog
Firebase Blog
Apigee Blog
Popular Posts
Understanding Cloud Pricing
World's largest event dataset now publicly available in BigQuery
A look inside Google’s Data Center Networks
Enter the Andromeda zone - Google Cloud Platform’s latest networking stack
New in Google Cloud Storage: auto-delete, regional buckets and faster uploads
Labels
Announcements
193
Big Data & Machine Learning
134
Compute
271
Containers & Kubernetes
92
CRE
27
Customers
107
Developer Tools & Insights
151
Events
38
Infrastructure
44
Management Tools
87
Networking
43
Open
1
Open Source
135
Partners
102
Pricing
28
Security & Identity
85
Solutions
24
Stackdriver
24
Storage & Databases
164
Weekly Roundups
20
Feed
Subscribe by email
Demonstrate your proficiency to design, build and manage solutions on Google Cloud Platform.
Learn More
Technical questions? Check us out on
Stack Overflow
.
Subscribe to
our monthly newsletter
.
Google
on
Follow @googlecloud
Follow
Follow