Created
April 20, 2017 01:17
-
-
Save albertomurillo/c4d4a68d1f3aee7a4f6e11ee0e3de271 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
import random | |
from ansible.module_utils.basic import AnsibleModule | |
def roulette(chambers): | |
return not random.randint(1, chambers) % chambers | |
def main(): | |
module = AnsibleModule( | |
argument_spec=dict( | |
chambers=dict(default=8, type="int"), | |
), | |
) | |
chambers = module.params["chambers"] | |
shot = roulette(chambers) | |
if shot: | |
module.fail_json(msg="You died") | |
else: | |
module.exit_json(msg="You survived") | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment