ansible中的冲突动作语句
我收到以下错误:ansible中的冲突动作语句,ansible,ansible-playbook,ansible-2.x,Ansible,Ansible Playbook,Ansible 2.x,我收到以下错误:ansible中冲突的操作语句 我试图理解,我的代码似乎是正确的。我正确地声明了名称,尽管它在任务名称中给出了一个错误 --- - hosts: webhost sudo: yes connection: ssh tasks: - name: debuging module shell: ps aux register: output debug: var=output 错误!冲突的行动声明 错误似乎出现在“/h
ansible中冲突的操作语句
我试图理解,我的代码似乎是正确的。我正确地声明了名称,尽管它在任务名称中给出了一个错误
---
- hosts: webhost
sudo: yes
connection: ssh
tasks:
- name: debuging module
shell: ps aux
register: output
debug: var=output
错误!冲突的行动声明
错误似乎出现在“/home/test/playbooks/debug.yml”中:第7行第7列,但可能出现在文件的其他位置,具体取决于语法问题
令人不快的一行出现在这里:
tasks:
- name: debuging module
^ here
问题是,您将两项任务混为一谈:
---
- 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
希望对您有所帮助谢谢您的回复。你能告诉我什么时候在任务中使用连字符,什么时候不使用连字符吗?这让我很困惑。在每个任务开始时使用连字符。我的回答解决了你的问题吗?是的,它解决了我的问题。但我只想知道什么时候使用连字符,什么时候不使用连字符。由于我不够清晰,我得到了这些错误。你能把它标记为有效答案吗,这个链接将帮助你理解