Hello team,
i want to call a shell script from ansible, this script may fail, so
ansible should retry the command, lets say 5 tries:
- name: process something, fail if not 5 files in tmpdir
shell: "/home/ivo/workspace/splunk-envs/scripts/retry/run.sh"
ignore_errors: True
register: status_var
until: status_var is not failed
delay: 1
retries: 4
That works pretty fine. Now, how can I pass the retry number to the run.sh?
The script should log, and it would be nice if the script would know if
there will be a retry on failure or not (last run or so).
I saw in documentation that there is some loop_control and
ansible_loop_index, but i cannot combine these variables with the shell
command in an until-loop. Is there a syntax problem or some better
way the achieve my goal?
What I have tried:
- name: process something, fail if not 5 files in tmpdir
loop_control:
extended: yes
shell: "/home/ivo/workspace/splunk-envs/scripts/retry/run.sh {{
lookup('vars', ansible_loop.index) }}"
ignore_errors: True
register: status_var
until: status_var is not failed
delay: 1
retries: 4
Thank you very much for any hints on this...
Ivo
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f489599e-f1fc-4f32-b64e-7aa77293e6b2%40googlegroups.com.