I am new to Ansible and have to update existing playbook tasks. Initially, there are 2 tasks to copy yml variable values to files - this runs in a loop per each cert and keys values. I want if the copy tasks are not changed - basically if the content is same the files are not overwritten, then the remaining tasks in the playbook should not be executed.
- name: Copy cert files
copy:
content: "{{item.value}}"
dest: /home/copyTest/dest/{{item.key}}.crt
owner: test
group: test
mode: 0644
with_dict: '{{certs_dict}}'
- name: Copy key files
copy:
content: "{{item.value}}"
dest: /home/copyTest/dest/{{item.key}}.key
owner: test
group: test
mode: 0644
with_dict: "{{keys_dict}}"
- name: Stop server
...
...
If both these copy tasks results are unchanged, i.e, none of certs and keys files are unchanged, then the further tasks(Stop server, Start server, etc.) should not be executed.