【问题标题】:Ansible AWX: wrong in PlaybookAnsible AWX:剧本中的错误
【发布时间】:2018-11-29 05:41:48
【问题描述】:

遵循我从 AWX Ansible 运行的 Playbook 的 yaml。

---
- hosts: all
  remote_user: root
  tasks:
  - copy: 
      content: "My content" 
      dest: "01.txt"

但得到以下异常:-

Cannot parse as JSON (error: No JSON object could be decoded) or YAML (error: Input type `list` is not a dictionary).

有人可以帮忙吗?

【问题讨论】:

    标签: ansible yaml ansible-awx


    【解决方案1】:

    content:dest: 不应与 copy: 位于同一缩进:

    tasks:
    - copy:
        content: hello world
        dest: /etc/passwd
    

    【讨论】:

      【解决方案2】:

      请参阅复制模块的 ansible 指南:

      - name: Copy using the 'content' for inline data
        copy:
          content: '# This file was moved to /etc/other.conf'
          dest: /etc/mine.conf'
      

      ** 基本上 content 和 dest 不应与 copy 处于同一标识级别。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-01-20
        • 1970-01-01
        • 2020-06-02
        • 2019-08-22
        • 1970-01-01
        • 1970-01-01
        • 2020-05-08
        • 1970-01-01
        相关资源
        最近更新 更多