You are on page 1of 1

- hosts: blocks

tasks:
- name: copy a file, but do not copy if the file already exists
copy:
src: challenge/fresco_when/defaults/simplefile.txt
dest: /home/user/test/simplefile.txt

when: ansible_selinux.status == "enabled"

when: p.stat.exists == False


---
- hosts: localhost
tasks:

tasks:
- name: Ansible copy file to a remote server
copy:
src: challenge/fresco_when/defaults/simplefile.txt
dest: /home/usr/test/simplefile.txt

- name: copy a file, but do not copy if the file already exists
ansible.builtin.copy:
src: challenge/fresco_when/defaults/simplefile.txt
dest: /home/user/test/simplefile.txt

ERROR! We were unable to read either as JSON nor YAML, these are the errors we got
from each:

JSON: No JSON object could be decoded

Syntax Error while loading YAML.

did not find expected '-' indicator

The error appears to be in '/projects/challenge/fresco_when/tasks/main.yml': line


3, column 3, but may

be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Ansible copy file to a remote server

roles:

^ here

SCORE:0%

You might also like