Hello All,
Could you please explain why do I have error here?
`
Hello All,
Could you please explain why do I have error here?
`
several errors, each task needs a -, register and when are task
directives and not part of the modules so need to be at the same
level:
- hosts: all
tasks:
- name: copy the script
copy: src=/etc/ansible/sample.pl dest=/root/sample.pl mode=0700
- stat: path=/root/sample.pl
register: st
name: checking that file is there, which is redundant if copy succeeded
- fail: msg="The script file wasn't copied to server
{{ansible_hostname}} {{ansible_default_ipv4.address}}."
when: st.stat.exists != True
name: again redundant as copy will show an error already for that
host if the script fails to be copied
Thank you, it works.
I realize the checks look redundant, it was just attempt to study how it can be used.