Awesome Vladimir, i just tried the solution that you have suggested. It's
working as per my requirement. Once again thank you so much.

Regards,
Suresh

On Mon, Apr 27, 2020 at 1:16 PM Vladimir Botka <[email protected]> wrote:

> On Mon, 20 Apr 2020 21:58:34 +0530
> Suresh Karpurapu <[email protected]> wrote:
>
> > ... to achieve my goal as iteration[*have multiple nfs volume in
> > CSV for each host*] is failing with add_host module due to
> *BYPASS_HOST_LOOP
> > = True* in module destination. ...
> > [...]
> > - name: list the volumes
> >   hosts: nfsgroup
> >   become: yes
> >   gather_facts: false
> >   tasks:
> >     - name: debug output
> >       debug:
> >         msg:
> >           - "{{ inventory_hostname }}"
> >           - "{{ var1 }}"
> >           - "{{ var2 }}"
> > [...]
> > - name: mounting the volume in the fstab file
> >   hosts: nfsgroup
> >   gather_facts: false
> >   become: yes
> >   tasks:
> >     - name: mounting the volume in the fstab file
> >       mount:
> >         fstype: nfs
> >         opts:
> >
> "rw,bg,hard,rsize=65536,wsize=65536,vers=3,actimeo=0,nointr,suid,timeo=600,tcp"
> >         dump: "0"
> >         passno: "0"
> >         src: "{{ var1[0] }}"
> >         path: "{{ var2[0] }}"
> >         state: mounted
> >       delegate_to: "{{ inventory_hostname }}"
> > ...
>
> delegate_to: "{{ inventory_hostname }}" is redundant.
>
> Try "with_together"
>
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-together
>
> - name: mounting the volume in the fstab file
>   hosts: nfsgroup
>   gather_facts: false
>   become: yes
>   tasks:
>     - name: mounting the volume in the fstab file
>       mount:
>         fstype: nfs
>         ...
>         src: "{{ item.1 }}"
>         path: "{{ item.2 }}"
>         state: mounted
>       with_together:
>         - "{{ var1 }}"
>         - "{{ var2 }}"
>
>
> > *Result:*
> > TASK [list the volumes]
> > ok: [host1] => {
> >     "msg": [
> >         "host1",
> >         [
> >             "nfsflr01:/volahcstg_www_masup_stg_data_01",
> >             "nfsflr02:/volahcstg_www_masup_stg_app_01"
> >         ],
> >         [
> >             "/myasup/stg/data",
> >             "/myasup/stg/app"
> >         ]
> >     ]
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAHedzhL46XVzu4aP5c540VY48v7j%2BkHL75AaH8GRXt3bCD9mHA%40mail.gmail.com.

Reply via email to