rob*_*ams 4 ansible ansible-playbook ansible-2.x
我收到以下错误:Conflicting action statement in ansible。
我试图理解,我的代码似乎是正确的。我正确地声明了名称,尽管它在任务名称中给出了错误。
---
- hosts: webhost
sudo: yes
connection: ssh
tasks:
- name: debuging module
shell: ps aux
register: output
debug: var=output
Run Code Online (Sandbox Code Playgroud)
ERROR! conflicting action statements
该错误似乎出现在“ /home/test/playbooks/debug.yml”中:第7行,第7列,但根据确切的语法问题,该错误可能出现在文件的其他位置。
令人讨厌的行似乎在这里:
tasks:
- name: debuging module
^ here
Run Code Online (Sandbox Code Playgroud)
这是问题所在,您将两个任务混为一谈:
---
- hosts: webhost
sudo: yes
connection: ssh
tasks:
- name: debuging module
shell: ps aux
register: output
- name: show the value of output
debug: var=output
Run Code Online (Sandbox Code Playgroud)
剧本的输出将是这样的:
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
Run Code Online (Sandbox Code Playgroud)
希望对您有帮助
| 归档时间: |
|
| 查看次数: |
7554 次 |
| 最近记录: |