运行以下 Playbook 语法似乎是正确的,但出现以下错误!-
ERROR! 'blockinfile' is not a valid attribute for a Play
The error appears to have been in '/root/playbook1.yml': line 2, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: insertupdate
^ here
我的 Playbook 文件代码是:
---
- name: insertupdate
blockinfile:
dest: /etc/network/interfaces
block: |
iface eth2 inet static
address 192.168.0.1
netmask 255.255.255.0
顺便说一句,我正在使用 Ansible 版本 2.x
您的剧本丢失了tasks
。就像错误所说,blockinfile
不是戏剧中的有效属性。你的剧本应该是这样的。只是一个例子,不要使用此代码。
- hosts: 127.0.0.1
tasks:
- name: insertupdate
blockinfile:
dest: /etc/network/interfaces
block: |
iface eth2 inet static
address 192.168.0.1
netmask 255.255.255.0
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)