0

遵循我从 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).

有人可以帮忙吗?

4

2 回答 2

2

content:并且dest:不应与以下缩进相同copy:

tasks:
- copy:
    content: hello world
    dest: /etc/passwd
于 2018-11-29T06:22:02.457 回答
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 处于同一标识级别。

于 2018-11-29T07:50:20.363 回答