The template task should loop over configout


On Fri, 23 Oct 2020 at 09:36, Sobhan Anavarapu <sobhan.anavar...@gmail.com>
wrote:

> Hi All,
> I am seeking for your help if I can create files in the controller node
> with the output we generate against the multiple IP's
> Eg: If I am passing 2 IP's with vars_prompt. In copy module it should
> create 2 different file with IP's we passed and save the data.
>
> ---
> - name: check
>   hosts: localhost
>   gather_facts: False
>
>   vars_prompt:
>   - name: ip_addr
>     prompt: Please enter the switch name
>     private: no
>
>    tasks:
>   - name: checking the switchshow
>     value_command:
>     switch_address: {{ item }}
>       command_set:
>         - command: portshow 1
>
>     with_items: "{{ ip_addr.split(' ') }}"
>     register: configout
>
>   - name: Copying the date to file
>     template:
>      src: report.j2
>      dest: "/root/file-{{ item }}.log"
>     become: true
>     delegate_to: localhost
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/d2eb4234-f6ba-4269-85e6-cb414f5ea4b1n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/d2eb4234-f6ba-4269-85e6-cb414f5ea4b1n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwPA%2B2Yd_uqTcTipR9AdackyUdoSEGLUsMF40XdNw3htfQ%40mail.gmail.com.

Reply via email to