1

Has anyone ever seen retries work on an ansible win_chocolatey task?

The follow seems to fail on the first attempt with no retries and I'm getting timeouts at the ansible level while choco attempts to install a package.

- name: Install Chocolatey
  win_chocolatey:
    name: a_package
    env: choco
  retries: 3

Have you successfully used retries with win_chocolatey tasks?

Possible Solution Using Henrik's suggestion and a block, I have retries plus a rescue/catch operation to fetch the choco log in case of errors after retries

- name: install applications
  block:
  - win_chocolatey:
      name: "{{ item }}"
      source:  "{{ choco_artifactory_source }}"
    register: result
    until: result.rc == 0
    retries: 3
    with_items:
      - wget
      - curl
  rescue:
  - fetch:
      src: "{{ choco_log }}"
      dest: "{{ agent_log_dir }}"
      flat: yes
Henrik Pingel
  • 9,380
  • 2
  • 28
  • 39
Peter Kahn
  • 207
  • 3
  • 11

1 Answers1

1

There is no until parameter defined, thus

If the until parameter isn’t defined, the value for the retries parameter is forced to 1.

applies.

See the documentation for do-until loops for more information.

Henrik Pingel
  • 9,380
  • 2
  • 28
  • 39