无法使用ansible-playbook更新xml元素值

时间:2019-03-20 11:29:27

标签: ansible

我正在使用下面的剧本来更新xml文件中的特定元素值及其抛出错误。我已经安装了python-lxml模块以及ansible版本2.7.8

---
 - name: Set element
   xml:
     path: /home/emsuser/appD_agent_master/machineagent/machine_agent/conf/controller-info.xml
     xpath: /controller-info/application-name
     value: "Vicom Enterprise blackout Manager"
...

回复:

ERROR! 'xml' is not a valid attribute for a Play

The error appears to have been in '/home/emsuser/playbooks/editMechineAgentConf.yml': line 2, column 4, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
 - name: Set element
   ^ here

我不确定我在哪里做错。请帮帮我。我是新来的。

1 个答案:

答案 0 :(得分:0)

您的代码不是剧本,而是任务文件。

在剧本中,您有一个tasks:部分列出了您的任务。

看看Playbooks intro documentation