Closed roded closed 1 month ago
Iniital discussion concludes we can address this with a playbook script. Fernando will respond to see if that is acceptable.
Hi @roded thanks for the suggestion. We are taking this conversation internally to review benefits and decide on it. In meantime, I'm sure this functionality can be achieved from ansible itself by retrying a task until a condition is met
- name: Copy to dest data set and retry is data set is locked
zos_copy:
src: "./files/file.txt"
dest: "{{ PDS_DATA_SET }}(FILE)"
register: result
retries: 10
delay: 5
You can add until
keyword to define a check on specific case, like until: result.msg.find("a task is accessing the data set.") == -1
.
If until is not specified, the task will retry until the task succeeds but at most retries times.
@fernandofloresg Thanks, I'll give it a shot.
@fernandofloresg Your solution works well enough for my purposes. I don't mind closing this ticket in light of it.
Is there an existing issue for this?
Enhancement or feature description
zos_copy currently supports force_lock to get around copying into data sets which are locked by other processes. As mentioned in the documentation, using force_lock can cause race conditions and data loss.
It would be useful if zos_copy would support waiting for a lock for a certain amount of time.
Ansible module
zos_copy