Re: [ansible-project] Comparing checksums on a group of files

2018-09-13 Thread Brian Coca
The template and copy modules do this automatically, files are only
copied if different.

-- 
--
Brian Coca

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7cwJEWgf%2B9fJXuLAcF1nHJ%3DBK3fi8ef5-y_Uv1c0wyz9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Comparing checksums on a group of files

2018-04-10 Thread Hank Beatty

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

--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/48787b85-2ac0-a230-e296-f14c293c4565%40gmail.com.
For more options, visit https://groups.google.com/d/optout.