What happened
You run ansible-playbook, and instead of tasks executing, you get this:
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to be in '/home/user/playbooks/deploy.yml': line 14, column 5
Ansible hit a task and couldn't work out what to do โ the module name doesn't match anything it knows. Nine times out of ten it's a typo, a wrong key name, or an indentation slip that makes a value look like a key.
Reproducing the error
Here's a minimal playbook that triggers it:
- name: Install nginx
hosts: webservers
tasks:
- name: Install nginx package
apt_pakage: # typo: should be apt or ansible.builtin.apt
name: nginx
state: present
Ansible parses apt_pakage, finds no matching module, and bails. The whole task block gets flagged โ nothing runs.
Debugging the error
Step 1 โ Read the line number in the error
Ansible almost always tells you the exact file and line:
The error appears to be in '/home/user/playbooks/deploy.yml': line 14, column 5
Go straight to that line. Don't scan the whole file.
Step 2 โ Check the module name for typos
Common culprits:
apt_pakageinstead ofaptsystemd_serviceinstead ofsystemdcopy_fileinstead ofcopygit_cloneinstead ofgitcomandinstead ofcommand
Not sure of the exact name? Look it up:
ansible-doc -l | grep <keyword>
# Example:
ansible-doc -l | grep apt
The FQCN format like ansible.builtin.apt also works and eliminates any ambiguity about which collection you're targeting.
Step 3 โ Check for indentation issues masking a module name
This one trips up a lot of people. If a module argument accidentally de-indents to the task level, Ansible reads it as a second module name:
# Broken โ 'state' looks like a module to Ansible
- name: Install nginx
apt:
name: nginx
state: present # โ wrong indent, now at task level
Ansible sees apt and state as two separate task-level keys. It can't resolve which is the action. Error fires.
Restore the indent and you're done:
- name: Install nginx
apt:
name: nginx
state: present # โ correctly indented under apt
Step 4 โ Validate the YAML structure
Before going deeper, rule out a basic YAML problem. Paste your playbook into the YAML โ JSON Converter at ToolCraft โ it converts YAML to JSON in the browser with nothing uploaded. A failed conversion or mangled structure points straight to an indentation or syntax issue. I use this regularly when a playbook looks fine visually but keeps erroring.
Ansible's own linter works too:
ansible-playbook --syntax-check deploy.yml
It catches module name errors without touching any hosts.
The fix
Usually it's a one-word change. Before and after:
# Before (broken)
- name: Restart nginx
systemd_service:
name: nginx
state: restarted
# After (fixed)
- name: Restart nginx
systemd:
name: nginx
state: restarted
Or spell it out with the FQCN to be completely explicit:
- name: Restart nginx
ansible.builtin.systemd:
name: nginx
state: restarted
Fixing a collection module path issue
Using a community or third-party collection? Make sure it's installed and the FQCN matches:
# Install the collection
ansible-galaxy collection install community.general
# Use the correct FQCN in your task
- name: Install pip package
community.general.pip:
name: requests
state: present
See what's already available on your control node:
ansible-galaxy collection list
Verification
Run the syntax check first:
ansible-playbook --syntax-check deploy.yml
# Expected output:
playbook: deploy.yml
Clean output means Ansible recognizes the module. Now do a dry run against your actual inventory:
ansible-playbook -i inventory.ini deploy.yml --check
If --check completes without the no action detected error, you're good.
Lessons learned
Cryptic as it looks, this error always means one thing: Ansible found a key in a task block it can't map to any module. Three causes, in order of how often you'll hit them:
- Typo in the module name โ the most common by far. Cross-check spelling with
ansible-doc -l. - Indentation drift โ a module argument slides to task level. VS Code with the YAML extension highlights this visually; it's worth the 30-second install.
- Wrong collection path โ using a community module without installing the collection, or getting the FQCN wrong.
Adding --syntax-check as a pre-flight step in your CI pipeline catches this entire class of error before it ever reaches a live host.

