首页 文章

Ansible AWX:Playbook中出错了

提问于
浏览
-1

以下是我从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).

任何人都可以帮忙吗?

2 回答

  • 2

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

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

    请参阅副本模块的安全指南:

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

    **基本上内容和目标不应与副本处于同一标识级别 .

相关问题