From 452bc3af043d51a1f82e4457c2a493823482222c Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 13 Nov 2020 16:00:21 -0500 Subject: [PATCH] example of exponential backup (#72617) --- .../rst/user_guide/complex_data_manipulation.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/docsite/rst/user_guide/complex_data_manipulation.rst b/docs/docsite/rst/user_guide/complex_data_manipulation.rst index 8466a3df2ce..66204768be4 100644 --- a/docs/docsite/rst/user_guide/complex_data_manipulation.rst +++ b/docs/docsite/rst/user_guide/complex_data_manipulation.rst @@ -25,6 +25,19 @@ Most programming languages have loops (``for``, ``while``, and so on) and list c - selectattr/rejectattr: very similar to the above but it uses a specific attribute of the list elements for the conditional statement. +.. _exponential_backoff: + +Use a loop to create exponential backoff for retries/until. + +.. code-block:: yaml + + - name: retry ping 10 times with exponential backup delay + ping: + retries: 10 + delay: '{{item|int}}' + loop: '{{ range(1, 10)|map('pow', 2) }}' + + .. _keys_from_dict_matching_list: Extract keys from a dictionary matching elements from a list