Hi Tim, Very good point. I will definitely change it accordingly. Thank you again.
Regards, Olivier On Thursday, 16 July 2015 20:53:15 UTC+1, Timothy Appnel wrote: > > I'm glad you were able to work something out and I was helpful. A couple > of quick added thoughts on this. > > I wouldn't recommend just dropping your library in to just /tmp to avoid a > potential conflict with another job or process. Perhaps create a separate > directory like the name of your project or playbook under tmp and store it > there? I think create a specific directory helps avoid this. > > I also wouldn't recommend embedding a library path in your custom module > for maintainability. It's working for you now, but the thought of having to > have that path line up in two different places make me uneasy. I used the > environment arg and appended the path to our libraries to PYTHONPATH. > Everything is in one place: the playbook. A var to hold the path (you can > use Ansible facts to really create a unique path that won't get tread on), > the path create, the copy, the environment setting. Change it in one place > and the change probates thru. > > Just some food for thought. > > <tim/> > > > On Thu, Jul 16, 2015 at 3:30 PM, Olivier Lauret <[email protected] > <javascript:>> wrote: > >> Hi Tim, >> >> Thank you very much for the update. It helps a lot, thank you very much. >> Indeed, I have chosen your second option as it is easier to maintain and >> avoid any conflict with other systems. The inifile.py is too big to be >> included in the custom module but I would not do this as I wouldn't be able >> to re-utilise it. >> >> Here is how I did it: >> >> In my playbook or role: >> tasks: >> - name: Upload python module >> copy: src=library/inifile.py dest=/tmp/inifile.py >> In my custom module: >> import sys >> sys.path.append('/tmp') >> from inifile import IniFile >> >> And to answer your question, what I am trying to achieve here is an >> extension to the ini_file module in Ansible. The current module doesn't >> answer my needs such as: >> >> - setting easily a continious list of options such as: >> - whitelist.0 = item1 >> - whitelist.1 = item2 >> - whitelist.2 = item3 >> - checking and replacing a list of options (such as ["ower", "owne"]) >> by one option name ("owner") >> - Dealing with options that doesn't have section (generally mean that >> this is default to all sections) >> - Dealing with empty name section ([]) and comments - this one I am >> less sure about but I know that the ConfigParser cannot handle this. >> >> Thank you again for your precious help. >> >> >> Regards, >> >> Olivier >> >> On Thursday, 16 July 2015 15:20:03 UTC+1, Timothy Appnel wrote: >>> >>> I didn't give up at all. Far from it! I started working for Ansible. >>> >>> Last I spoke to my former co-workers they are still using options 2 that >>> I setup because they do not have the ability to install python libraries in >>> the default library path. >>> >>> <tim/> >>> >>> >>> On Thu, Jul 16, 2015 at 10:14 AM, Martin <[email protected]> wrote: >>> >>>> Hi, >>>> >>>> On Thu, Jul 16, 2015 at 4:05 PM Timothy Appnel <[email protected]> >>>> wrote: >>>> >>>>> In a previous life I've had to do what you are attempting. >>>>> >>>> >>>> So what do you do now? It sound like you went on and are using a >>>> completely different approach to achieve what the op wants to do (load >>>> custom code) >>>> >>>> I'm not asking about options but rather what you actually ended up with >>>> doing (give up and/or stopped using the tool are viable answers to me) >>>> >>>> /Martin >>>> >>>> -- >>>> -- >>>> http://www.xing.com/profile/Martin_Marcher >>>> http://www.linkedin.com/in/martinmarcher >>>> Mobil: +43 / 660 / 62 45 103 >>>> UID: ATU68801424 >>>> >>>> -- >>>> 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/CAK1mKEQxjUW0kB9Yb426THm8HZCMOy%3DbdbCzztjARScFrYsKzQ%40mail.gmail.com >>>> >>>> <https://groups.google.com/d/msgid/ansible-project/CAK1mKEQxjUW0kB9Yb426THm8HZCMOy%3DbdbCzztjARScFrYsKzQ%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] <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/a7ac54d2-e808-4c46-855e-5f3326b5b069%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/a7ac54d2-e808-4c46-855e-5f3326b5b069%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/d741a709-3689-4e0b-8991-f9f9d0340474%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
