# Column does not work in lineinfile module

**URL:** <https://forum.ansible.com/t/column-does-not-work-in-lineinfile-module/14332>\
**Category:** Ansible Project\
**Created:** [January 13, 2014, 3:37pm UTC](https://forum.ansible.com/t/column-does-not-work-in-lineinfile-module/14332 "2014-01-13T15:37:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stas\_Oskin](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@Stas\_Oskin](https://forum.ansible.com/u/Stas_Oskin)\
**Post date:** [January 13, 2014, 3:37pm UTC](https://forum.ansible.com/t/column-does-not-work-in-lineinfile-module/14332/1 "2014-01-13T15:37:43Z")

</div>

Hi,

I’m trying to use an instruction with lineinfile:

- lineinfile: dest=“{{deploy\_root}}/{{instance}}/{{project}}/{{project}}/local\_settings.py” regexp=‘^NAME’ line=“‘NAME’: ‘{{db\_name}}’,”

No matter what I try, the column does not work.

Any ideas will be appreciated!

---

<div class="post-metadata">

**Author:** ![PhilEv](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@PhilEv](https://forum.ansible.com/u/PhilEv)\
**Post date:** [January 15, 2014, 10:02am UTC](https://forum.ansible.com/t/column-does-not-work-in-lineinfile-module/14332/2 "2014-01-15T10:02:40Z")

</div>

That should help

&nbsp;&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- a\_column: "\x3A"

and use {{ a\_column}} in the expression

There should be a proper/better way to escape it,  
I think the point is arround the " " (\<white space\>) that is after  
the ':' so Yaml consider this a a mapping

HTH

---

<div class="post-metadata">

**Author:** ![kahlil.hodgson](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kahlil.hodgson](https://forum.ansible.com/u/kahlil.hodgson)\
**Post date:** [January 15, 2014, 9:48pm UTC](https://forum.ansible.com/t/column-does-not-work-in-lineinfile-module/14332/3 "2014-01-15T21:48:30Z")

</div>

try the YAML ‘\>’ escaping mechanism ([http://yaml.org/spec/current.html#id2503232](http://yaml.org/spec/current.html#id2503232)):

lineinfile: \>  
dest=“{{deploy\_root}}/{{instance}}/{{project}}/{{project}}/local\_settings.py”  
regexp=‘^NAME’  
line=“NAME: {{db\_name}},”

The lines following the ‘\>’ to be interpreted as a scalar and not a potential YAML structure.

K
