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 ?