From a073e1a899af0206d5de8a5e90b114805742f166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Francisco=20San=20Nicol=C3=A1s=20Mart=C3=ADne?= =?UTF-8?q?z?= Date: Tue, 23 Nov 2021 15:39:30 +0100 Subject: [PATCH 1/5] Testing with command --- async_tasks.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/async_tasks.yml b/async_tasks.yml index c3a62d1413..5e36d4f47d 100644 --- a/async_tasks.yml +++ b/async_tasks.yml @@ -11,7 +11,7 @@ run_once: true - name: Poll a sleep - shell: "sleep 10" + command: "sleep 10" async: 30 poll: 5 @@ -19,9 +19,7 @@ msg: "I'm a debug message." - name: Fire and forget a slow command - shell: | - sleep 15 - touch /tmp/test_file + command: "sleep 15 && touch /tmp/test_file" async: 30 poll: 0 register: fired @@ -36,9 +34,7 @@ retries: 20 - name: Fire and forget a slow reversal - shell: | - sleep 10 - rm -f /tmp/test_file + command: "sleep 10 && rm -f /tmp/test_file" async: 30 poll: 0 register: fired From 4a6344eb053c870cbc4fb93d0e179ab460585c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Francisco=20San=20Nicol=C3=A1s=20Mart=C3=ADne?= =?UTF-8?q?z?= Date: Tue, 23 Nov 2021 15:44:54 +0100 Subject: [PATCH 2/5] Testing with command Testing with become true Testing with become yes --- .gitignore | 1 + async_tasks.yml | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 152f908b86..34c31dc315 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc +.idea /tower_collection_actual.yml \ No newline at end of file diff --git a/async_tasks.yml b/async_tasks.yml index 5e36d4f47d..ec2389f502 100644 --- a/async_tasks.yml +++ b/async_tasks.yml @@ -1,7 +1,8 @@ --- -- hosts: all - gather_facts: false +- name: Run Async Tasks playbooks + hosts: all + gather_facts: true tasks: - name: Create the async directory to prevent race conditions @@ -13,7 +14,7 @@ - name: Poll a sleep command: "sleep 10" async: 30 - poll: 5 + poll: 0 - debug: msg: "I'm a debug message." @@ -28,7 +29,9 @@ msg: "I'm another debug message." - name: Examine slow command - async_status: jid={{ fired.ansible_job_id }} + async_status: + jid: "{{ fired.ansible_job_id }}" + mode: status register: slow_command until: slow_command.finished retries: 20 @@ -43,7 +46,9 @@ msg: "I'm yet another debug message." - name: Examine slow reversal - async_status: jid={{ fired.ansible_job_id }} + async_status: + jid: "{{ fired.ansible_job_id }}" + mode: status register: slow_command until: slow_command.finished retries: 20 From 2d2855b3d7db02150f38d0ccaafd574c98a760b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Francisco=20San=20Nicol=C3=A1s=20Mart=C3=ADne?= =?UTF-8?q?z?= Date: Thu, 25 Nov 2021 12:56:54 +0100 Subject: [PATCH 3/5] Trying with poll as 5 --- async_tasks.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/async_tasks.yml b/async_tasks.yml index ec2389f502..74f145766a 100644 --- a/async_tasks.yml +++ b/async_tasks.yml @@ -14,7 +14,7 @@ - name: Poll a sleep command: "sleep 10" async: 30 - poll: 0 + poll: 5 - debug: msg: "I'm a debug message." @@ -22,7 +22,7 @@ - name: Fire and forget a slow command command: "sleep 15 && touch /tmp/test_file" async: 30 - poll: 0 + poll: 5 register: fired - debug: @@ -39,7 +39,7 @@ - name: Fire and forget a slow reversal command: "sleep 10 && rm -f /tmp/test_file" async: 30 - poll: 0 + poll: 5 register: fired - debug: From 78515ce30b2e95e53010a08ef383c71c2cde3dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Francisco=20San=20Nicol=C3=A1s=20Mart=C3=ADne?= =?UTF-8?q?z?= Date: Thu, 25 Nov 2021 13:12:29 +0100 Subject: [PATCH 4/5] Adding directory under tmp --- async_tasks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/async_tasks.yml b/async_tasks.yml index 74f145766a..b4ef0303e6 100644 --- a/async_tasks.yml +++ b/async_tasks.yml @@ -7,7 +7,7 @@ - name: Create the async directory to prevent race conditions file: - path: ~/.ansible_async + path: /tmp/.ansible_async state: directory run_once: true From 80917c04f9bcf42463ac3b9fdad4d1e6dacdccbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Francisco=20San=20Nicol=C3=A1s=20Mart=C3=ADne?= =?UTF-8?q?z?= Date: Thu, 25 Nov 2021 14:50:19 +0100 Subject: [PATCH 5/5] Adding directory under tmp --- async_tasks.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/async_tasks.yml b/async_tasks.yml index b4ef0303e6..d22da4e45c 100644 --- a/async_tasks.yml +++ b/async_tasks.yml @@ -7,9 +7,8 @@ - name: Create the async directory to prevent race conditions file: - path: /tmp/.ansible_async + path: ~/.ansible_async state: directory - run_once: true - name: Poll a sleep command: "sleep 10"