Hi,

Me also I need to change the /etc/exports but I can't use the template as 
this config file is shared with another system which don't use ansible :-D
I did some investigation and in fact just "t.t()" is enough to generate the 
quote (took me some hours to find the good combinaison).

But anyway there is a fix in 1.7.1 
(https://github.com/ansible/ansible/issues/8535)

Cheers,
Vincent

Le mercredi 3 septembre 2014 00:46:14 UTC+2, Michael DeHaan a écrit :
>
> If you like, please file a bug on github.com/ansible/ansible 
> <http://www.google.com/url?q=http%3A%2F%2Fgithub.com%2Fansible%2Fansible&sa=D&sntz=1&usg=AFQjCNFG4hdpwNy0ydKfw-wmCTBou9FufA>
>  
> so we can investigate.
>
>
>
>
> On Tue, Sep 2, 2014 at 9:33 AM, Matteo Ceccarello <[email protected] 
> <javascript:>> wrote:
>
>> Thank you for the suggestions and sorry for the late reply.
>>
>> I'll try the templates module. As for the mount module, as far as I 
>> understant it's to configure /etc/fstab on the client side. I'm trying to 
>> configure the server side, i.e. /etc/exports. Anyway, I'll definetly use 
>> the mount module on the clients.
>>
>> Back to the parentheses problem, the version of Ansible I'm using is 1.7 
>> from the Fedora repositories.
>>
>> Matteo
>>
>>
>> Il giorno mercoledì 27 agosto 2014 11:44:10 UTC+2, Dan Vaida ha scritto:
>>
>>> May I suggest the following way of doing it:
>>>
>>> - name: mounting shares
>>>   mount: name={{ item.name }} src={{ item.src }} fstype=nfs opts={{ 
>>> item.opts }} state=mounted
>>>   with_items:
>>>     - { name: '/root/nfs',    src: 'hostname:/ExportName',    opts: 
>>> 'defaults' }
>>>     [...]
>>>   tags: nfs
>>>
>>> The mount module works like a charm and the documentation is really 
>>> clear on the various states it supports.
>>>
>>> On Tuesday, 26 August 2014 15:57:30 UTC+2, Matteo Ceccarello wrote:
>>>>
>>>> Hi all!
>>>>
>>>> I'm trying to use the lineinfile module to configure NFS exports and I 
>>>> need to put parentheses in my line argument. 
>>>>
>>>> If I do something like this
>>>>
>>>> - name: Export the NFS directory for root
>>>>   lineinfile: dest=/etc/exports 
>>>>               regexp='/root/nfs'
>>>>               line='/root/nfs 192.168.1.0/255.255.255.0(rw,
>>>> no_root_squash,subtree_check)'
>>>>
>>>> I get a line in my /etc/exports that looks like
>>>>
>>>> '/root/nfs 192.168.1.0/255.255.255.0(rw,no_root_squash,subtree_check)'
>>>>
>>>> That is, surrounded by quotes. The problem is that this format is 
>>>> invalid, so I have to remove the quotes.
>>>> I made a few tests, and I found out that removing the parentheses works
>>>>
>>>> - name: Test
>>>>   lineinfile: dest=/etc/exports
>>>>               line="/root/nfs 192.168.1.0/255.255.255.0"
>>>>
>>>> yields the following line (without quotes)
>>>>
>>>> /root/nfs 192.168.1.0/255.255.255.0
>>>>
>>>> whereas reintroducing the parentheses reintroduces also quotes
>>>>
>>>> - name: Test
>>>>   lineinfile: dest=/etc/exports
>>>>               line="/root/nfs 192.168.1.0/255.255.255.0()"
>>>>
>>>> '/root/nfs 192.168.1.0/255.255.255.0()'
>>>>
>>>> I tried to escape the parentheses and this removes the quotes, but 
>>>> escape chars remain!
>>>>
>>>> - name: Test
>>>>   lineinfile: dest=/etc/exports
>>>>               line="/root/nfs 192.168.1.0/255.255.255.0\(\) 
>>>> <http://192.168.1.0/255.255.255.0%5C(%5C)>"
>>>>
>>>> /root/nfs 192.168.1.0/255.255.255.0\(\) 
>>>> <http://192.168.1.0/255.255.255.0%5C(%5C)>
>>>>
>>>> Is this a bug? Am I missing something?
>>>>
>>>> Thank you very much :-)
>>>>
>>>> Matteo
>>>>
>>>  -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/4361ae18-41fa-431a-a0ba-89cc2814c17a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/4361ae18-41fa-431a-a0ba-89cc2814c17a%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/57d77358-4209-4a11-8281-cb5113d82f35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to