Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conflicting action statement in ansible

Tags:

I am getting the following error : Conflicting action statement in ansible.

I tried to understand, my code seems to be correct. I declared the name correctly though it gives an error in the task name.

Playbook:

---  - hosts: webhost    sudo: yes    connection: ssh     tasks:     - name: debuging module       shell: ps aux       register: output       debug: var=output 

Error message:

ERROR! conflicting action statements  The error appears to have been in '/home/test/playbooks/debug.yml': line 7, column 7, but may be present elsewhere in the file depending on the exact syntax problem.  The offending line appears to be here:             tasks:         - name: debuging module           ^ here 
like image 971
robert williams Avatar asked Jun 26 '16 02:06

robert williams


1 Answers

Here is the problem, you have mixed up two tasks into one:

--- - hosts: webhost   sudo: yes   connection: ssh    tasks:     - name: debuging module       shell: ps aux       register: output      - name: show the value of output       debug: var=output 

And out put of the playbook will be like this:

PLAY [all] *********************************************************************  TASK [setup] ******************************************************************* ok: [192.168.33.100]  TASK [debuging module] ********************************************************* changed: [192.168.33.100]  TASK [show the value of output] ************************************************ ok: [192.168.33.100] => {     "output": {         "changed": true,         "cmd": "ps aux",         "delta": "0:00:00.004981",         "end": "2016-06-26 06:25:22.975876",         "rc": 0,         "start": "2016-06-26 06:25:22.970895",         "stderr": "",         "stdout": "USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND\nroot         1  0.8  0.2  24432  2380 ?        Ss   06:23   0:00 /sbin/init\nroot         2  0.0  0.0 

Hope that help you

like image 103
Arbab Nazar Avatar answered Oct 30 '22 13:10

Arbab Nazar