2016-06-26 9 views
2

次のエラーが表示されます:Conflicting action statement in ansible対応可能なアクション文がありません

私は理解しようとしましたが、私のコードは正しいようです。私はタスク名に誤りを出すが、名前を正しく宣言した。

--- 
- hosts: webhost 
    sudo: yes 
    connection: ssh 

    tasks: 
    - name: debuging module 
     shell: ps aux 
     register: output 
     debug: var=output 

ERROR! conflicting action statements

エラーが「/home/test/playbooks/debug.yml」にされているように見えます:行7、列7が、正確な依存ファイル内の別の場所に存在してもよいです構文の問題。

問題のある行は、ここに表示されます。ここでは

tasks: 
    - name: debuging module 
    ^here 

答えて

3

が問題である、あなたは1に2つのタスクが混ざっている:脚本の

--- 
- hosts: webhost 
    sudo: yes 
    connection: ssh 

    tasks: 
    - name: debuging module 
     shell: ps aux 
     register: output 

    - name: show the value of output 
     debug: var=output 

そしてアウトプットは次のようになります:あなた

助ける

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 

・ホープ

+0

ご返信ありがとうございます。ハイフンをいつ使用するのか、ハイフンを使用しないのか教えてください。本当に混乱します。 –

+0

各タスクの先頭にハイフンを使用します。私の答えはあなたの問題を解決するのですか? –

+0

はい、それは私の問題を解決しました。しかし、私はちょうどハイフンを使用するときとハイフンを使用しないときを知りたい。 becoz私は明確さが不足している、私はそれらのエラーを取得しています。 –

関連する問題