[ansible-project] Re: Ansible - overwriting file lineinfile when run in parallel

2019-06-26 Thread Tony Chia
Since you are using local_action, it will execute on the ansible controller 
instead of remote host 
local_action is an alternative way of doing delegate_to: localhost. These 
actions will be executed on local machine (Ansible control host)
I don't see how it would behave differently if you use serial:1 or 5 which 
is the default. 

On Tuesday, June 25, 2019 at 3:25:31 AM UTC-7, Josephsimon Arokiaraj wrote:
>
> Hi All,
>
> I am running the below code in a playbook which iterates over many hosts. 
> This script writes the value of ver.stdout to a file. I am seeing issue 
> when I run in in parallel. It is overwriting. It works good when serial:1 
> but it consumes long time since we have large number of hosts. 
>
> Any help to run in parallel and improve the time consumption?
>
>
> - name: Write version output
>   local_action: lineinfile create=yes line={{ item }} insertafter=EOF 
> dest={{ dest_file }}
>   when: ver.stdout != ""
>   with_items:
> - "{{ ver.stdout | regex_replace('\r\n' , '#' )}},{{ 
> inventory_hostname }}"
>
>
> Cheers,
> Joseph
>   
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/85f5831e-21f9-41ef-b814-35a77c7ca5d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible - overwriting file lineinfile when run in parallel

2019-06-26 Thread Josephsimon Arokiaraj


On Tuesday, June 25, 2019 at 11:25:31 AM UTC+1, Josephsimon Arokiaraj wrote:
>
> Hi All,
>
> I am running the below code in a playbook which iterates over many hosts. 
> This script writes the value of ver.stdout to a file. I am seeing issue 
> when I run in in parallel. It is overwriting. It works good when serial:1 
> but it consumes long time since we have large number of hosts. 
>
> Any help to run in parallel and improve the time consumption?
>
>
> - name: Write version output
>   local_action: lineinfile create=yes line={{ item }} insertafter=EOF 
> dest={{ dest_file }}
>   when: ver.stdout != ""
>   with_items:
> - "{{ ver.stdout | regex_replace('\r\n' , '#' )}},{{ 
> inventory_hostname }}"
>
>
> Cheers,
> Joseph
>   
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4c0caa2f-28be-44d7-b2cb-4ddfd85a51ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible - overwriting file lineinfile when run in parallel

2019-06-26 Thread Josephsimon Arokiaraj
Hi All,

Any update on this please?

Cheers,
Simon J

On Tuesday, June 25, 2019 at 11:25:31 AM UTC+1, Josephsimon Arokiaraj wrote:
>
> Hi All,
>
> I am running the below code in a playbook which iterates over many hosts. 
> This script writes the value of ver.stdout to a file. I am seeing issue 
> when I run in in parallel. It is overwriting. It works good when serial:1 
> but it consumes long time since we have large number of hosts. 
>
> Any help to run in parallel and improve the time consumption?
>
>
> - name: Write version output
>   local_action: lineinfile create=yes line={{ item }} insertafter=EOF 
> dest={{ dest_file }}
>   when: ver.stdout != ""
>   with_items:
> - "{{ ver.stdout | regex_replace('\r\n' , '#' )}},{{ 
> inventory_hostname }}"
>
>
> Cheers,
> Joseph
>   
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d43b0d3e-e017-409f-b2b0-232e59fee527%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.