Re: [ansible-project] using anyconfig-0.0.5 as a module in ansible

33 views
Skip to first unread message

Michael DeHaan

unread,
Dec 11, 2014, 7:16:24 PM12/11/14
to ansible...@googlegroups.com
"  Are there any other requirements or protocols unique to windows modules? "

Generally if submitting them to core (I don't understand anyconfig yet so not sure we'd take it), docs go in a corresponding ".py" file (see other windows modules for an example.

But that's pretty much it - just follow the examples of the others, etc.



On Thu, Dec 11, 2014 at 5:16 PM, skinnedknuckles <andersonj...@gmail.com> wrote:
Along with updating software remotely I need to update multiple parameter files where sometimes values are to be overwritten and other times original values should be persisted (maintained) if they already exist. I found a python library called anyconfig which seems to have this capability using the MS_REPLACE and MS_NO_REPLACE flags.  So as I understand, in order to use this code as an ansible module I need to modify it to conform to ansible module standards as defined in the documentation.  And since my remote nodes are windows machines it will be set up to run on windows and the module name should be prefixed with "win_" like all the other windows modules.  Are there any other requirements or protocols unique to windows modules?  This is a bit over my head so before I dive in and wrestle with it for days I just want to be sure I'm on the right track. OR maybe there is an easier way to do this. And I'd like to know that I'm attempting something that is at least in the realm of possibility.  Any comments or suggestions are welcome.

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ee88172a-b916-4092-ae7b-a165238f0045%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

J Hawkesworth

unread,
Dec 13, 2014, 12:47:14 PM12/13/14
to ansible...@googlegroups.com
Sounds to me like maybe you are after win_copy, win_template and win_lineinfile modules. I have created PRs for the first two.

If you don't mind working from development version of Ansible you could try them now. I'd be grateful for any feedback.

That might get you most of what you need, with the exception of replacing lines in existing files. You might find using the existing lineinfile module as a starting point would be a help. Actually, thinking about it, you might be able to make use of a combination of of fetch, lineinfile and win_copy to manipulate the configuration files, if you can run lineinfile delegated to your Ansible controller, and you can get away with replacing the files on your windows nodes.


Jon


J Hawkesworth

unread,
Dec 13, 2014, 12:51:01 PM12/13/14
to ansible...@googlegroups.com

Michael DeHaan

unread,
Dec 15, 2014, 6:56:21 AM12/15/14
to ansible...@googlegroups.com
A second copy of lineinfile is something I do want to avoid :)

The others are good things.  We may still look at how to make these share more in common using the 'v2/' codetree when that gets closer to completeness.

Thanks!

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages