I just ported the copy module over, as well as added the md5 function to the core API (because it is useful), saving about 40 lines of code.
See the source of library/copy for how it looks now -- this is the pattern to follow.
Who wants to help with others?
Here are the basic steps:
(1) Put the main body of the code for the module in a main() function if it does not already have one
(2) Put the magic import code at the bottom of the file
(3) At the top of the main function, instantiate the AnsibleModule class with a variable spec
(4) Replace any exit or fail methods with calls to module.exit_json or module.fail_json as appropriate. In fail_json
methods you may remove any setting of variables called "failed" as that is done for you. Replace any exit_json
calls that set "failed" with fail_json calls.
(5) test the module using ./hacking/test-module, like this:
./hacking/test-module ./library/copy src=/tmp/alpha dest=/tmp/beta
As we port things, we may create bugs. This is why the development branch is exciting. Report them when you find them. Or better, fix them!
That's it! I am giving out double ansible bonus points to anyone helping with this. They can be redeemed at your local systems management software
amusement park on Tuesdays for discounts on selected merchandise.
--Michael