小编Kar*_*Vee的帖子

运行以下Playbook语法似乎是正确的但是获得了ERROR! - 'blockinfile'不是Play的有效属性

运行以下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
Run Code Online (Sandbox Code Playgroud)

我的Playbook文件代码是:

---
- name: insertupdate
  blockinfile:
    dest: /etc/network/interfaces
    block: |
      iface eth2 inet static
          address 192.168.0.1
          netmask 255.255.255.0        
Run Code Online (Sandbox Code Playgroud)

顺便说一句,我使用的是Ansible Version 2.x.

ansible ansible-playbook ansible-2.x

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

ansible ×1

ansible-2.x ×1

ansible-playbook ×1