The job finished. Automation Controller shows it as Successful, the status icon is green, and nobody gets paged. Then someone logs in to one of the servers and finds that the setting you just rolled out isn’t there. The package is still the old version. The file was never touched.
A green job in Ansible Automation Platform (AAP) means one narrow thing: no task failed and every host was reachable. It does not mean the change happened, and it does not mean it happened on the hosts you had in mind. Those are different questions, and the UI will happily let you confuse them.
This post goes through the usual reasons a job template can run green and still change nothing, and ends with a checklist and a small guardrail you can add to your playbooks.
Start by reading the recap, not the colour
Every job ends with a play recap per host: ok, changed, unreachable, failed, skipped, rescued and ignored. The job status only looks at failures and unreachable hosts. Everything else is up to you to read.
changed=0 on its own is not a problem. On a second run of a good, idempotent playbook, it is exactly what you want. The trouble is when changed=0 shows up on a run that should have changed something, usually together with one of these signals:
- Far fewer hosts in the recap than you expected, or none at all
- A high
skippedcount on the tasks that do the actual work - A non-zero
ignoredcount, meaning a task failed and the playbook told Ansible not to care - A play that printed
skipping: no hosts matchedand moved on
If you see any of those, the job did not succeed at what you wanted, even if the status says it did. The causes almost always fall into four buckets.
1. The job ran in check mode
Job templates have a Job Type field with two values: Run and Check. Check runs the playbook with --check. Modules that support check mode report what they would do and then do nothing. The job is green, the output can even show changed results, and the hosts stay exactly as they were.
This happens more often than people admit. A template gets copied from a dry-run version, or Job Type is set to prompt on launch and someone picks Check from a workflow or an API call. The same applies to home-made dry-run switches, such as an extra variable like apply_changes: false with a safe default that nobody overrides in production.
2. The play targets hosts that never get the change
Inventory and limit decide which hosts a job touches. When they don’t line up with the play’s hosts: pattern, Ansible doesn’t always fail. It quietly works on a different set of machines than you think.
- An empty group. If the play says
hosts: webserversand that group is empty in this inventory, Ansible prints a warning, skips the play, and the job ends green. A--limitthat matches nothing at all fails loudly; an empty group inside the play does not. - The wrong inventory. The template points at a test inventory, or inventory is set to prompt on launch and a workflow node or API call passes a different one. The playbook did real work, just on machines nobody was looking at.
- A stale inventory source. The cloud or CMDB sync hasn’t run since the new servers were built, so they don’t exist as far as Controller knows. Turning on update on launch for the source, or scheduling syncs, closes that gap.
- A limit that is too clever. Limits like
prod:&dc2:!legacyare powerful and easy to get slightly wrong. A typo in a group name silently drops a whole slice of hosts. - Facts that don’t match the conditions. Tasks guarded by
when: ansible_distribution_major_version == '8'skip every host once the fleet is on 9. Everything isokorskipped, nothing is changed.
The fastest check is the job details page. It shows the inventory, the limit and the job type the run actually used, which may differ from what the template says if anything was prompted on launch. Compare the host count in the recap with the number you expected before you look at anything else.
3. Privilege escalation isn’t wired up
Most real changes need root: installing packages, editing files under /etc, restarting services. In AAP, that depends on two separate things lining up:
- Become has to be turned on. Either the job template has Privilege Escalation enabled, or the play or task sets
become: true. If neither does, tasks run as the connecting user. - The Machine credential has to support it. The credential needs the right privilege escalation method (usually sudo), and a become password if the target’s sudo rules ask for one.
Usually a missing become fails loudly with a permission error. It turns quiet when the playbook makes failure acceptable: ignore_errors: true, failed_when: false, or a block with a rescue that only logs. It also turns quiet when a task can succeed without root, for example by writing a config file into the connecting user’s home directory because a path was built with ~, or by managing a user-level service instead of the system one.
Roles that guard their work with conditions such as when: ansible_user_id == 'root' are another quiet failure: without become, every important task is skipped and the job is green.
4. The wrong credential is attached
AAP has many credential types, and a job template can carry several at once. That flexibility makes it easy to attach something that looks right but doesn’t give the playbook what it needs.
- A Machine credential for the wrong account. The job connects as a read-only or service user that can log in but not change anything that matters.
- A cloud or API credential that doesn’t match the playbook. Credential types inject environment variables or extra variables. If the playbook looks for a different variable name, or falls back to a default endpoint when the value is missing, it talks to the wrong account, region or API and finds nothing to change.
- A custom credential type that injects nothing. The injector configuration is easy to get wrong. The credential is attached, but the variables the playbook reads are empty, and a
default()filter hides it.
A good rule: a playbook should fail when a required credential value is missing, not reach for a default. Defaults belong on tuning knobs, not on where the automation connects.
A checklist for green jobs that changed nothing
When a job looks successful but the change isn’t there, go through this list in order. It is roughly sorted by how quickly you can rule each item out.
- Job type. Open the job details and confirm it ran as Run, not Check. Look for dry-run extra variables too.
- Host count. Count the hosts in the recap. If it is lower than you expected, or zero for a play, look at inventory and limit before anything else.
- Inventory and limit used. Check the values on the job, not on the template. Prompt on launch, workflows and API launches can all override them.
- Inventory freshness. Confirm the inventory source synced recently and contains the hosts you meant to change.
- Skipped and ignored counts. Find which tasks skipped and why. Search the playbook and roles for
ignore_errorsandfailed_when: false. - Privilege escalation. Confirm become is enabled on the template or in the play, and that the Machine credential has the right method and password.
- Credentials. Confirm each attached credential is the right type and account, and that the variables it injects are the ones the playbook reads.
- Verify on the target. Log in or run an ad hoc command against one host and check the actual state. The recap tells you what Ansible believes; the host tells you what is true.
Make the playbook refuse to be quietly green
Checklists help after the fact. It is better to have the playbook fail when it isn’t doing what you expect. Two small preflight checks catch most of the cases above: one that refuses to run when the target group is empty after inventory and limit, and one that confirms the job really runs as the user the change needs.
- name: Preflight - make sure this run can actually change something
hosts: all
gather_facts: false
tasks:
- name: Fail if the target group is empty after inventory and limit
ansible.builtin.assert:
that:
- groups[target_group] | default([]) | intersect(ansible_play_hosts_all) | length > 0
fail_msg: "No hosts in '{{ target_group }}' after inventory and limit. Nothing would change."
run_once: true
- name: Apply the change
hosts: "{{ target_group }}"
pre_tasks:
- name: Check which user tasks really run as
ansible.builtin.command: id -un
register: effective_user
changed_when: false
- name: Fail early if privilege escalation is not in effect
ansible.builtin.assert:
that:
- effective_user.stdout == (expected_user | default('root'))
fail_msg: "Running as {{ effective_user.stdout }}, expected {{ expected_user | default('root') }}. Check become and the Machine credential."
Pair that with a verification task at the end of the play, one that checks the state you care about (a package version, a line in a config file, a service that answers) and fails if it isn’t there. Then green means what people already assume it means.
If the job also behaves differently in Controller than on your laptop, the runtime is the next thing to look at. We covered that in why Ansible playbooks break in AAP and how execution environments fix it.
Green should mean done
A job status is only as useful as the questions behind it. If the team treats green as “the change is in place”, the playbooks have to earn that: right job type, the right hosts, real privileges, the right credentials, and a check at the end that proves the result.
Building that in from the start is much cheaper than finding out weeks later that a hardening or patching job has been doing nothing on half the fleet. It is also one of the things worth agreeing on when you scope an automation project: not just what the automation should do, but how you will know that it did.



Leave a Reply