Created
August 10, 2018 23:24
-
-
Save austincunningham/9964aa0998f39c1f45922155e232499a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from ansible.module_utils.basic import * | |
def main(): | |
fields = { | |
"version_no": {"default": True, "type": "str"}, | |
"version_name": {"default": True, "type": "str"}, | |
"unchanged_value": {"default": True, "type": "str"} | |
} | |
module = AnsibleModule(argument_spec=fields) | |
# change the name | |
module.params.update({"version_name": "After"}) | |
# bump minor and patch version | |
mylist = module.params["version_no"].split('.') | |
mylist[2] = str(int(mylist[2]) + 2) | |
mylist[1] = str(int(mylist[1]) + 1) | |
mystr= '.'.join(mylist) | |
module.params.update({"version_no": mystr}) | |
module.exit_json(changed=True, meta=module.params) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment