human01302015
human01302015

Reputation: 1

Ansible script module throws syntax error

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.

Upvotes: 0

Views: 609

Answers (2)

OneCricketeer
OneCricketeer

Reputation: 191973

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

Upvotes: 0

techraf
techraf

Reputation: 68629

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

You need to split script and shell into two tasks.

Upvotes: 1

Related Questions