foreman-ansible-modules
foreman-ansible-modules copied to clipboard
redhat_manifest does not handle changes correctly
SUMMARY
When downloading a manifest with redhat_manifest
the file is always updated and the status from the task is always ok.
When the local file is not present and manifest is downloaded the task status should be changed.
If running a playbook twice to download the manifest ideally the local file should not be updated on the second run when identical.
Here's the snippet I'm using:
- name: Get manifest from Red Hat Customer Portal
redhat.satellite.redhat_manifest:
uuid: "{{ manifest_uuid }}"
username: "{{ redhat_portal_username }}"
password: "{{ redhat_portal_password }}"
path: /root/satellite_manifest.zip
register: manifest_download
After this manifest_download is changed
is never true.
Thanks.
Just so that I can understand it correctly: You have a manifest on the portal, and only want the module to download it, right?
Yeah, I can see how it doesn't return changed=True
in that specific case.
Correct, my playbook deals with either an already present manifest or downloads one by itself depending on the case, then it continues after that with common operations such as upload, refresh, etc so that is the rationale for doing only the download. Thanks.
So I tried implementing this, and it didn't go exactly as expected.
The problem is, whenever we hit the /export
endpoint in the portal, it does generate a net-new export (even if the contents didn't change since the last export), so the checksum of the downloaded file doesn't match and we end up always reporting a change when export is used.
This is IMHO also wrong?
If you want to try it, the code is at https://github.com/evgeni/foreman-ansible-modules/commit/change-manifest