Running Ansible?

Ansible playbooks nobody can run any more? We sort it out.

Ansible playbooks tend to age in silence. The role that provisioned the first fleet of servers still exists, and nobody has touched it in four years, and now a fresh host refuses to come up because half the tasks assume a Python that no longer ships. We inherit these repos, bring the roles onto the current Collections model, and leave a playbook you can run on a Tuesday afternoon without a prayer.

  • Since 2015Fixing technology
  • FreeEstimates
  • US teamReal engineers

ansible-playbook.log

still failing

What it is

Ansible at a glance

Ansible is an open-source configuration management and automation tool written by Michael DeHaan in 2012, acquired by Red Hat in 2015, and now part of the IBM portfolio. It ships without an agent on the target host: control nodes ship Python over SSH and run modules remotely, which is why Ansible spread quickly through teams that could not install agents on everything.

A codebase is a set of playbooks (YAML), roles (reusable groups of tasks), inventory (hosts and groups), and increasingly Collections (namespaced bundles of modules and plugins). The ecosystem moved most non-core modules into Collections starting with Ansible 2.10, which is the single biggest piece of upgrade work for older playbooks. AWX and Red Hat Ansible Automation Platform sit on top as the UI and orchestration layer for larger estates.

Type
Agentless configuration management and automation
First released
2012
License
GPL-3.0 for core, various for community collections
Maintained by
Red Hat, IBM, and the Ansible community
Typically used for
Server provisioning, application deployment, network device config, patch rollout, ad-hoc operations

The honest version

Ansible pros and cons

No technology is all upside. This is where Ansible earns its place and where it tends to cause trouble.

Where Ansible is strong

  • No agent on the targetSSH and Python on the host is all that is required. New fleets do not need a bootstrap tool to install the configuration tool before they can be configured.
  • YAML is easy to read on a FridayPlaybooks look like a list of steps because they are a list of steps. Engineers who have never seen Ansible can usually follow what a role does on first read.
  • The module library is enormousBetween core, community.general and the vendor collections, almost every system or service has a module written already. New code is usually a last resort rather than the first move.
  • Good fit for mixed estatesLinux, Windows, network devices and cloud APIs all respond to playbooks. Teams running a bit of everything can keep one tool rather than four.
  • Idempotency is the defaultModules describe a desired state and change the host only when it does not already match. Re-running a playbook is safe by convention, which encourages running it often.

Where Ansible bites

  • Playbooks drift and nobody noticesWithout regular runs, drift accumulates on hosts and the first run after months discovers surprises in production. The agentless model trades setup time for ongoing discipline.
  • The Collections migration is real workAny playbook written before Ansible 2.10 uses module names that no longer resolve in core, and requires requirements.yml plus namespaced calls. A codebase that was never ported runs on borrowed time.
  • Error messages are not always kindA failed module returns a MODULE FAILURE with a traceback inside a JSON payload, and the real cause is often a Python version mismatch three layers down on the target.
  • Speed suffers on large inventoriesSSH to a thousand hosts, serially by default, is not fast. Forks, strategies and pipelining help, but out of the box Ansible is slower than agent-based alternatives at scale.
  • Secrets management is bolt-onAnsible Vault works for small teams and clashes with proper secret stores at larger ones. Integration with Vault, AWS Secrets Manager or SOPS is possible but needs work.
  • Dynamic inventory is not plug and playCloud inventory plugins exist for every provider, but each has its own configuration, caching and auth story, and the first run against a new account is rarely clean.

Sound familiar?

Common Ansible problems we fix

The Ansible problems that bring people to us, and what you have once each one is fixed.

MODULE FAILURE

A module fails on a host that worked yesterday

A Python version change on the target, a missing system package the module depends on, or a selinux context that silently blocks the operation. The JSON output has the real message if you know where to look.

Module running cleanly on every host

UNREACHABLE: Connection timed out

Hosts cannot be reached over SSH

A security group change, a rotated key that never made it onto the control node, or a jump host added in front of the fleet without the ssh_config being updated.

Connectivity stable from the control node

role was not found

Roles do not resolve any more

An ansible-galaxy requirements file that was never installed in CI, a role pinned to a Git tag that has been deleted, or a local roles path that moved during a refactor.

Role resolution deterministic in CI

couldn't resolve module/action 'community.general.ufw'

Collections never got installed

A playbook that was written on Ansible 2.9 with core modules, running against Ansible 2.14 where those modules live in Collections, with no requirements.yml telling it where to find them.

Collections pinned and installed

Attempting to decrypt but no vault secrets

Vault passwords are missing

A vault-encrypted variable file but no --vault-password-file or ANSIBLE_VAULT_PASSWORD_FILE pointing at the key, often because a CI runner was rebuilt and the secret was never restored.

Vault access restored and documented

Timeout waiting for privilege escalation prompt

sudo prompts hang the playbook

A sudoers configuration that still asks for a password where the playbook assumed NOPASSWD, or a change to the account the control node is logging in as.

Privilege escalation fast and silent

conditional check: ansible_facts ... is undefined

Facts gathering is incomplete

A play that skipped gather_facts for speed, and later tasks that rely on ansible_facts without checking. The conditional explodes on the first host that runs them.

Facts available where tasks expect them

PLAY RECAP: failed=3

A nightly run has started reporting failures

A cron run against a growing fleet where three hosts now fail and nobody looks at the logs. Drift accumulates, and the first fresh provisioning after that discovers problems that have been there for weeks.

Nightly runs green and watched

What we do

Ansible help, from rescue to upkeep

Call us for one broken playbook, or hand us the whole config management repo.

Rescue
Playbooks that will not run, hosts that cannot be reached, or a provisioning pipeline red for weeks. We get a clean run first, and explain what caused the drift second.
Collections migration
Porting a pre-2.10 codebase onto namespaced modules and a pinned requirements.yml, so the playbooks work on current Ansible rather than one specific version from the past.
Inherited repos
Taking over an Ansible repository from a team that has moved on, mapping what each playbook does to the hosts it targets, and leaving documentation alongside the code.
Secrets and vault
Replacing hand-rolled Vault files with integration into HashiCorp Vault, AWS Secrets Manager or SOPS, so secrets live in one place with proper access controls.
AWX and Automation Platform
Setting up AWX or Red Hat Ansible Automation Platform so playbooks run on a schedule, through an audit trail, with role-based access rather than from a single engineer's laptop.
Managed Tech
Playbook upgrades, nightly run monitoring, collection and role version watch, and someone to call when a fresh host refuses to come up.

How it works

From first message to fixed

  1. Look Free estimate

    Tell us what's going wrong. We look at it, then tell you plainly what's wrong and what it will cost.

  2. Fix

    We fix the cause, not the symptom. If something is down, getting it back up comes first.

  3. Harden

    Backups, monitoring, updates and access, so the same problem can't quietly come back.

  4. Hand back or stay on

    You get a plain-language write-up. Or we stay on for hosting, upkeep and new work.

Often found together

Running Ansible alongside something else?

We work on the whole stack, so the problem can be wherever it actually is.

Questions

Ansible questions

Something else? Call+1 737 727 7327

Why does our Ansible playbook fail on a fresh host?

Three usual reasons show up: the Python on the target is not the version the playbook assumes and modules fail with a traceback inside a JSON payload, a collection or role was never installed because requirements.yml is not run in CI, and privilege escalation times out because sudo wants a password where the playbook expects NOPASSWD. We fix each piece against a disposable test host before touching production.

Can you take over an Ansible repo from a previous team?

Yes. We start by inventorying which playbooks exist, which hosts they target, and which of them still run cleanly on current Ansible. Then we port whatever is still useful onto Collections, document the pieces that genuinely are not worth saving, and hand back a repository that a new engineer can run on their first day.

Should we migrate from Ansible to Terraform or Pulumi?

They are different tools. Terraform and Pulumi describe infrastructure (the server exists, the network exists). Ansible describes the state of the host once it is up (packages, users, services, config files). Most teams end up running both: infrastructure code to create the hosts, and Ansible or cloud-init to configure them. We help work out where the line is in your estate.

Why did the Ansible upgrade break all our playbooks?

Ansible 2.10 moved most modules into Collections and later versions enforced it. A playbook using community.general.ufw or amazon.aws.ec2_instance without a requirements.yml and the namespaced call will not resolve the module. The fix is to pin the collections you need, install them in CI, and rewrite the short module names into their fully qualified form.

How do we handle secrets in Ansible properly?

Ansible Vault is fine for very small teams with one password holder. Anything larger wants a real secret store: HashiCorp Vault, AWS Secrets Manager or SOPS with age keys are the three we most often reach for. The playbooks then fetch secrets at run time through a lookup plugin, and nothing sensitive sits inside Git in encrypted-blob form.

How much does Ansible help cost?

The quote comes at no charge. Describe the repo, the Ansible version, and the failure you are hitting, and we respond with a price before any changes happen.

Free estimate

Ansible giving you trouble?

Tell us what you're running and what's going wrong. A person reads it and comes back with an estimate.

  • No charge to find out what it will take
  • If it's urgent, say so

Replies come from a person. By sending, you authorize us to email you back. No marketing.