Hi,
Basically would like to check if file is present on remote system or not.
If not present, then create one, otherwise skip this step.
- name: Checking if files already present
stat:
path: "{{ item }}"
register: file_path
with_items:
- /var/abc.key
- /var/xyz.key
- /var/spk.key
- name: Creating files
file:
path: "{{ item }}"
state: touch
owner: root
group: named
mode: 0644
with_items:
- /var/abc.key
- /var/xyz.key
- /var/spk.key
when: file_path.stat.exists == False
Any ideas ?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f2f8bca6-ac65-4db9-bf78-93ae2f64feeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.