Hello,
I would like to compare checksums on a group of files and then copy the new file over the old file if different.
Here is what I have so far:
- name: Get Checksum for Old Comparison Zone Files
stat:
path: "{{ named_options.directory }}/.{{ item.file }}.old"
register: named_old_zones_stat
with_items: "{{ named_zones | default([]) }}"
- debug:
var: named_old_zones_stat
- name: Create New Comparison Zone Files
template:
src: zone_hidden.j2
dest: "{{ named_options.directory }}/.{{ item.file }}.new"
with_items: "{{ named_zones | default([]) }}"
- name: Get Checksum for New Comparison Zone Files
stat:
path: "{{ named_options.directory }}/.{{ item.file }}.new"
register: named_new_zones_stat
with_items: "{{ named_zones | default([]) }}"
- name: Copy the New Comparison Zones Over Old if Different
template:
src: zone_hidden.j2
dest: "{{ named_options.directory }}/.{{ item.file }}.old"
with_items: "{{ named_zones | default([]) }}"
when:
The last task is where I am stumbling. I was thinking of using “with_nested” in the last task, but I cannot seem to make it work. Does anyone have any suggestions?
Thanks,
Hank