lundi 25 janvier 2021

Ansible assign random number and increase the retry attempts

I am trying to assign a random number between 7000 and 7005 to a variable which is not present in a list. the list has 7000, 7001, 7004 and 7002.

- name: Set fact 
  set_fact:
    val: "7004"
  until: val not in list  

The above playbook tried to assign 3 times and failed. It did not assign the value 7003.

TASK [xxx] ******************************
task path: /tmp/awx_164677__l9__xmu/project/roles/xxxxx/tasks/main.yml:26
FAILED - RETRYING: Set fact  (3 retries left).
FAILED - RETRYING: Set fact  (2 retries left).
FAILED - RETRYING: Set fact  (1 retries left).
fatal: [xxxprod]: FAILED! => {"ansible_facts": {"val": "7000"}, "attempts": 3, "changed": false}

How to increase the retry value from 3 to some other value?

Note: the above list was updated by this playbook, only the last value did not get updated.

Thanks.




Aucun commentaire:

Enregistrer un commentaire