Thanks for this

Based on your post , and in my case where the statement is spread over
multiples lines
I just found the following to work (tend to always forgot the yaml syntax
for multi-line )
which to me is even simpler (this is just me) as no even need to double
quote

  lineinfile: >
    dest=/etc/hosts.deny
    state=present
    regexp="^ALL:\s+ALL"
    line="ALL: ALL"
--
Phil


2014-03-19 16:51 GMT+01:00 Adam Morris <[email protected]>:

>
>
> On Wednesday, March 19, 2014 7:49:33 AM UTC-7, Philippe Eveque wrote:
>>
>>
>>
>> Using the lineinfile module, the only way I found for a line to contain a
>> column character, is to use something like I described.
>>
>> That is having a variable being defined like:
>>
>> a_column: "\x3A"
>>
>> and in the playbook a task like:
>>
>> lineinfile:
>>   dest=/etc/hosts.deny
>>   state=present
>>   regexp='^ALL:\s+ALL'
>>   line="ALL{{ a_column }} ALL"
>>   insertafter=EOF
>>
>>
>>
> Actually it's easier than that...
>
> I have a module where I need a colon in a lineinfile entry...
>
> - name: search files then dns for hosts
>   lineinfile: 'backup=yes dest={{network_switch}} state=present
>                regexp="^hosts:" line="hosts:      files dns"'
>
> Not just one colon in that line but two...
>
> I found that the double quoting was necessary, but there you go.
>
> Adam
>
>
>
> --
> 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/00977514-ef1b-49fd-984c-c17222ebdf79%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/00977514-ef1b-49fd-984c-c17222ebdf79%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAB1FMuQg0tA5rscqKA3pQY0HWt5kkF-w4TK633Tsbu%2BaUAaN%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to