0

playbook image

Ansible syntax validation throws error message as below:

ERROR! no action detected in task. This often
indicates a misspelled module name, or incorrect module path.

The error appears to have been in '/mgdbplybks/test.yml': line 16,
column 5, but may be elsewhere in the file depending on the exact
syntax problem.

The offending line appears to be:

  tasks:
  - name: launch mongod replA
    ^ here
===================================================== 

If I comment out the script module, syntax check is okay.

1
  • Please do not add images when text is enough. It makes questions unsearchable. Commented Mar 4, 2017 at 0:00

2 Answers 2

1

You cannot add two actions (modules) to a single task in Ansible.

You need to split script and shell into two tasks.

Sign up to request clarification or add additional context in comments.

Comments

0

no action detected in task. This often indicates a misspelled module name

As the error says, you have a -name that is empty.

tasks:
- name: launch mongod replA
- script:... 

The script is a second task. The first is empty.

Did you mean this?

tasks:
- name: launch mongod replA
  script: /scripts/mgdbscripts/replsetA.sh

4 Comments

name is not empty. It has the script module as action. Attached image of the playbook
You had -name: ..., then -script: ... shell:... The - character lists each task to be done. Since you had -script, then the -name task did nothing, as the error says
There were two actions/modules being used in one task. Changing that fixed the issue. Regarding the usage of -...that might be okay. YAML syntax docs.ansible.com/ansible/YAMLSyntax.html
Your original question had an empty named task and two actions in one. I only addressed the first of those problems

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.