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 c3a62d1413..d22da4e45c 100644 --- a/async_tasks.yml +++ b/async_tasks.yml @@ -1,17 +1,17 @@ --- -- 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 file: path: ~/.ansible_async state: directory - run_once: true - name: Poll a sleep - shell: "sleep 10" + command: "sleep 10" async: 30 poll: 5 @@ -19,35 +19,35 @@ 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 + poll: 5 register: fired - debug: 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 - 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 + poll: 5 register: fired - debug: 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