I updated the copy module to support base 64 encoded content (details here https://github.com/ansible/ansible-modules-extras/pull/142). In order to update the copy module, I needed to update the ActionModule object which is part of the main ansible project. I basically added a boolean parameter called “b64_encoded” that, when set to true, will attempt to base64 decode the “content” parameter before writing it to a file. This works perfectly when either the file didn’t exist already, or the file is being changed. However, I am receiving the error “unsupported parameter for module: b64_encoded” whenever the module should be returning unchanged. Please see an example below:
First run, file does not exist
$ ansible all -m copy -a “content=SGVsbCBXb3JsZA== b64_encoded=true dest=/tmp/copy_output” -i /tmp/hosts -v
localhost | success >> {
“changed”: true,
“checksum”: “3710fad362f1436cca4539485a56fbd4742d933e”,
“dest”: “/tmp/copy_output”,
“gid”: 1000,
“group”: “derek”,
“md5sum”: “fe05c18b23d7defae2e24a3a6432b9c0”,
“mode”: “0644”,
“owner”: “derek”,
“size”: 10,
“src”: “/home/derek/.ansible/tmp/ansible-tmp-1419012506.95-106112902391882/source”,
“state”: “file”,
“uid”: 1000
}
Second run, same exact command as above. Notice the checksum is the same:
$ ansible all -m copy -a “content=SGVsbCBXb3JsZA== b64_encoded=true dest=/tmp/copy_output” -i /tmp/hosts -v
localhost | FAILED >> {
“checksum”: “3710fad362f1436cca4539485a56fbd4742d933e”,
“failed”: true,
“msg”: “unsupported parameter for module: b64_encoded”
}
I’m running Arch Linux with the following python 2.7.9 and the latest ansible/devel version. At this point I am unsure if this is a problem with my development environment or a something I missed in the code when I added that parameter to the ActionModule? Has anyone experienced a similar problem?
Changes to the ActionModule can be found here:
https://github.com/danderson189/ansible/commit/24a884fb287c9a2d0b544e240676b089dc85671e
Changes to the copy module can be found here:
https://github.com/danderson189/ansible-modules-core/commit/cefee98b47f962c83b75db60c231409e415dc7f3