I would recommend  the Template module to do it

while technically possible with lineinfile, the regular expression to do it
will be overly complex
and hard to read/maintain

Le mer. 11 sept. 2019 à 16:06, TheSmiths <[email protected]> a écrit :

> Hi,
>
> I would like to use lineinfile module to do the next:
>
> 1. go over list of items (with_items)
> 2. look for specific line that always starts with the word "ALL:"
> (hosts.allow)
> 3. append each item at the END of the line with comma before the item
>
> for example
>
> ALL ,1.1.1.1/255.255.255.255 , 2.2.2.2/255.255.255.255
>
> Thanks,
> Morrissey
>
>
> --
> 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/12fd72e2-f7cb-4911-b4c5-dcc4ce9b3f97%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/12fd72e2-f7cb-4911-b4c5-dcc4ce9b3f97%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAB1FMuQLhF%2B5q7or9xkVw1kR%3DBGmucPRp5uoiGOP59Bh6vNonQ%40mail.gmail.com.

Reply via email to