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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to