Thank you for your reply.
I tried using strategy as free and unable to use async in the task as task 
has dependency task. Could you please suggest code change or alternate 
method for running the task in parallel.

---
- name: Main playbook
  gather_facts: no
  hosts: 127.0.0.1
  strategy: free

  tasks:
    - name: Create csv file and html file
      file:
        path: "{{ item }}"
        state: touch
      delegae_to: localhost
      become_user: awx
      become: no
      with_items:
        - /tmp/apache.csv
        - /tmp/apache.html

    - include_vars: apache_sever_list.yaml

    - include_tasks: apache_task.yaml
      with_items: '{{ apacheSevers }}'

    - name: Run the csv2html script
      shell: |
        echo "<h3>List of failed Apache servers</h3>"
        echo "<table>" ;
        echo "<table><tr><th>Hostname</th><th>Port</th></tr>"
        while read INPUT; do
        echo "<tr><td>${INPUT//,/</td><td>}</td></tr>";
        done < /tmp/apache.csv
        echo "</table>"
      delegae_to: localhost
      become_user: awx
      become: no        

    - name: append
      lineinfile:
        dest: /tmp/apache.html
        line: "{{ output.stdout }}"
        insertafter: EOF
      delegae_to: localhost
      become_user: awx
      become: no



*apche_task.yaml*

    - name: Check the apache server status
      uri:
        url: "{{ item.hostname }}:{{ item.port }}"
        method: GET
        status_code: 200
        body_format: raw
        follow_redirects: all
        return_content: yes
        validate_certs: no
        force: yes
      delegae_to: localhost
      become_user: awx
      become: no


    - name: append output to file
      lineinfile:
        dest: /tmp/apache.csv
        line: "{{ item.hostname }},{{ item.port }}"
        insertafter: EOF
      delegae_to: localhost
      become_user: awx
      become: no 




On Wednesday, November 14, 2018 at 9:07:18 AM UTC-5, Brian Coca wrote:
>
> I would look at the 'free' strategy, but you have others: 
>
> https://docs.ansible.com/ansible/latest/plugins/strategy.html#plugin-list 
>
>
>
>
> -- 
> ---------- 
> Brian Coca 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6e1928d0-ff0d-422a-85c4-9c6b3051aee0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to