I was hoping for a reply from Nick re the above but it may be you work together?
In the above it appeared he had a "space" but it appears in your example you are talking about a non-space character. On Wed, Mar 19, 2014 at 10:49 AM, Philippe Eveque <[email protected] > wrote: > Hi Michael, > > sure the version info and output are much needed ! > > I had a very similar uses case to what I understood from Nick. > I needed to insert/insure a line such as below being declared in > /etc/hosts.deny file: > ALL: ALL > > 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 > > > > Having the following task will not work: > > lineinfile: > dest=/etc/hosts.deny > state=present > regexp='^ALL:\s+ALL' > line="ALL: ALL" > > and lead to the following output: > > ERROR: Syntax Error while loading YAML script, > <path>/host_access_restricted/tasks/main.yml > Note: The error may actually appear before this position: line 33, column > 14 > regexp='^ALL:\s+ALL' > line="ALL: ALL" > ^ > ansible-playbook version in my case is 1.5.3 > > Not sure if the above error really is an error or should be considered as > a bug. > Note: this is old code on my side and IIRC I applied this workaround since > ansible >= 1.2 > > HTH > > Phil. > > > > 2014-03-19 15:00 GMT+01:00 Michael DeHaan <[email protected]>: > >> Hi Phil, >> >> There are no such sequences in the above post. Still waiting on >> version info and output. >> >> >> >> On Wed, Mar 19, 2014 at 8:52 AM, Philippe Eveque < >> [email protected]> wrote: >> >>> Something like this should help >>> Assuming the following variable declaration >>> >>> vars: >>> - a_column: "\x3A" >>> >>> >>> then later you can have: >>> >>> line="ALL{{ a_column }} ALL" >>> >>> >>> -- >>> Phil >>> >>> 2014-03-19 1:43 GMT+01:00 Nick Doyle <[email protected]>: >>> > Hm I still get the prob .. >>> > >>> > - name: allow gateway >>> > sudo: yes >>> > lineinfile: >>> > line="ALL: 127.0.0.1" >>> > dest=/etc/hosts.allow >>> > >>> > >>> > On Saturday, 13 April 2013 03:43:03 UTC+10, Michael DeHaan wrote: >>> >> >>> >> Right, hence "If there is a colon in a YAML line, it must be quoted." >>> >> >>> >> >>> >> On Fri, Apr 12, 2013 at 1:13 PM, Peter Klausner <[email protected] >>> > >>> >> wrote: >>> >>> >>> >>> For the record, this syntax did it: >>> >>> >>> >>> lineinfile: "... line='foo: bar' ..." >>> >>> >>> >>> Note that the documentation still samples the wrong syntax: >>> >>> http://ansible.cc/docs/modules.html#lineinfile >>> >>> >>> >>> And note that recent sudo supports the /etc/sudoers.d directory, >>> >>> which obsoletes mucking with lineinfile in this case. >>> >>> >>> >>> -- >>> >>> 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]. >>> >>> >>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >>> >>> >> >>> >> >>> >> >>> >> >>> >> -- >>> >> Michael DeHaan <[email protected]> >>> >> >>> >> CTO, AnsibleWorks, Inc. >>> >> http://www.ansibleworks.com/ >>> >> >>> > -- >>> > 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/28583879-97bb-4260-b772-66f05b853a0f%40googlegroups.com >>> . >>> > 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/CAB1FMuRGujTpYb-RO_puRo9rN%2BDFa2wrf78PzxU7Lm7k%3DvWc7Q%40mail.gmail.com >>> . >>> >>> 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/CAEVJ8QOgKEDeoz0f2VOEZUe9%3D5vZZBkOyqbxAYV%3DA8Ap3JLPww%40mail.gmail.com<https://groups.google.com/d/msgid/ansible-project/CAEVJ8QOgKEDeoz0f2VOEZUe9%3D5vZZBkOyqbxAYV%3DA8Ap3JLPww%40mail.gmail.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/CAB1FMuS4yQ4pu1KnSjPi_aunh5Y6kLE3NVy55yP9FDv9brshoA%40mail.gmail.com<https://groups.google.com/d/msgid/ansible-project/CAB1FMuS4yQ4pu1KnSjPi_aunh5Y6kLE3NVy55yP9FDv9brshoA%40mail.gmail.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/CAEVJ8QNxV%2BfBGrfv8RrrCYZm%3D%2BLp78FpkMgK7X83YH3THdYxfg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
