gpt4 book ai didi

ansible - ansible 中的冲突操作声明

转载 作者:行者123 更新时间:2023-12-02 14:33:07 25 4
gpt4 key购买 nike

我收到以下错误:ansible 中的操作语句冲突

我试图理解,我的代码似乎是正确的。我正确地声明了名称,但它在任务名称中给出了错误。

剧本:

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

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

错误消息:

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

最佳答案

问题在于,您将两项任务混合为一项:

---
- 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

希望对你有帮助

关于ansible - ansible 中的冲突操作声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38034777/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com