0

Following in yaml of Playbook which I am run from AWX Ansible.

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

But getting following exception:-

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

Can anyone help on this?

Vivek Sable
  • 9,938
  • 3
  • 40
  • 56

2 Answers2

2

content: and dest: should not be at the same indentation as copy::

tasks:
- copy:
    content: hello world
    dest: /etc/passwd
mdaniel
  • 31,240
  • 5
  • 55
  • 58
2

Refer the ansible guideline for copy module:

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

** Basically content and dest should not be at the same identation level as copy.

Swapnil
  • 61
  • 1
  • 6