The Simplest Way to Make Ansible and Google Cloud Deployment Manager Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use ansible and google cloud deployment manager to build and set up cloud servers. Google Cloud Deployment Manager creates the cloud resources, and Ansible sets up the apps inside them. This split keeps your daily work clean and simple. One tool owns the cloud state, and the other tool runs the server setup tasks. How ansible and google cloud deployment manager share data and roles First, Google Cloud Deployment Manager reads your templates and builds your cloud network and machines. I

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use ansible and google cloud deployment manager to build and set up cloud servers. Google Cloud Deployment Manager creates the cloud resources, and Ansible sets up the apps inside them.

This split keeps your daily work clean and simple. One tool owns the cloud state, and the other tool runs the server setup tasks.

How ansible and google cloud deployment manager share data and roles

First, Google Cloud Deployment Manager reads your templates and builds your cloud network and machines. It keeps track of every virtual machine, disk, and network rule in your project. Once those machines start up, Ansible steps in to do its job.

Ansible needs to find the new machines before it can set them up. It uses a dynamic inventory plugin to ask Google Cloud for a list of active servers. This plugin reads machine tags, group names, and network addresses straight from the cloud API.

To make this work, both tools need the right cloud roles and permissions. Google Cloud Deployment Manager uses a built-in cloud service account to create and change resources. Ansible uses its own service account key or short-lived token to read the server list. Then Ansible logs in to each machine over SSH to install packages and write files.

Common failure modes and how to scope roles

Many teams make the mistake of sharing one service account between both tools. They often give this single account full project owner rights to save time. If that key leaks, an attacker can delete your whole cloud project right away.

Broad tokens and shared SSH keys also ruin your audit logs. When five engineers use the same static key, your logs cannot show who ran a play. You only see the shared service account name in the cloud log history. Unlogged runs make it hard to fix broken servers or pass security checks.

GCP Access Context Manager + Deployment Approval Gates: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix this by giving each tool its own scoped role. Give the deployment tool permission to build only the specific resources in your templates. Give the Ansible inventory role read-only rights to view instances and network tags. Do not let the inventory role create or delete cloud machines.

You should also lock down the network paths between your control node and your cloud servers. Do not open SSH ports to the whole public internet. Route your setup traffic through a private network link or a controlled entry point. Use short-lived SSH certificates tied to real user identities instead of static keys on laptops.

Keeping day-two changes clean between both tools

Problems also happen when both tools try to change the same cloud setting. For example, an engineer might use an Ansible task to open a cloud firewall port. Later, Google Cloud Deployment Manager runs again and wipes out that manual firewall change.

Set a strict rule for your team to prevent this conflict. Keep all cloud network, disk, and machine creation inside your deployment templates. Keep OS updates, app code, and local service files inside your Ansible plays. When each tool stays in its lane, your runs stay predictable and safe.

Test your templates and plays in a small staging project before production runs. Check your cloud audit logs after each test to spot any failed permission checks. This habit helps you catch bad role rules before they block a release.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Which tool should run first in a build pipeline?

Run Google Cloud Deployment Manager first so it can create the virtual machines and networks. Run Ansible second after the new machines pass their basic boot checks.

How does Ansible know which Google Cloud servers to set up?

Ansible uses a Google Cloud dynamic inventory plugin to query your project API. It groups your servers by their cloud labels, zones, and network tags during the run.

Should Ansible create Google Cloud resources directly?

No, let Google Cloud Deployment Manager handle all resource creation so state stays in one place. Use Ansible only for OS setup, app installs, and guest level tasks.

The query runs. The emails stay hidden.