Have you tried the replace module?
Would it be feasible for you to template that file?

On Sunday, 8 February 2015 14:19:10 UTC+1, [email protected] wrote:
>
>
>
> On Sunday, February 8, 2015 at 9:26:30 PM UTC+11, Giovanni Tirloni wrote:
>>
>> On Fri, 06 Feb 2015 18:38 -0800, [email protected] wrote: 
>> > Hi! 
>> > 
>> > The following ansible snippet worked fine in 1.7, but throws an error 
>> in 
>> > 1.8. I suspect it has something to do with the {% .. %} string I'm 
>> trying 
>> > to insert into the file. I tried different ways to escape it, but can't 
>> > find the solution. 
>> > 
>> >     - name: add logon banner 
>> >       lineinfile: 
>> > 
>> dest=/usr/lib/python2.7/dist-packages/horizon/templates/auth/_login.html 
>> > regexp='^  </fieldset>' line="  </fieldset>{% include \"banner.html\" 
>> %}" 
>> > 
>> > fatal: [node] => template error while templating string: unexpected 
>> char 
>> > u'\\' at 127 
>> > 
>> > Without escaping the double quotes I get a different error: 
>> > 
>> >       lineinfile: 
>> > 
>> dest=/usr/lib/python2.7/dist-packages/horizon/templates/auth/_login.html 
>> > regexp='^  </fieldset>' line='  </fieldset>{% include "banner.html" %}' 
>> > 
>> > fatal: [node] => an unexpected type error occurred. Error was no loader 
>> > for 
>> > this environment specified 
>>
>> Does it work if you use pure YAML syntax? 
>>
>> - name: add logon banner 
>>   lineinfile: 
>>     dest: 
>>     /usr/lib/python2.7/dist-packages/horizon/templates/auth/_login.html 
>>     regexp: '^  </fieldset>' 
>>     line: '  </fieldset>{% include "banner.html" %}' 
>>
>> Giovanni 
>>
>
> Unfortunately not. I tried:
>
>     - name: add logon banner
>
>       lineinfile:
>
>         dest: 
> /usr/lib/python2.7/dist-packages/horizon/templates/auth/_login.html
>
>         regexp: '^  </fieldset>'
>
>         line: '  </fieldset>{% include "banner.html" %}'
>  
>
> TASK: [add logon banner] 
> ****************************************************** 
>
> fatal: [node11] => an unexpected type error occurred. Error was no loader 
> for this environment specified
>

-- 
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/04c2663c-bbc1-4292-a23f-b8deda2fdb4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to