Skip to content

Instantly share code, notes, and snippets.

@elnygren
Last active April 26, 2017 19:02
Show Gist options
  • Select an option

  • Save elnygren/66f98e2cfd743aa043dc553524265608 to your computer and use it in GitHub Desktop.

Select an option

Save elnygren/66f98e2cfd743aa043dc553524265608 to your computer and use it in GitHub Desktop.
Minimum Viable Ansible Module
from ansible.module_utils.basic import *
module = AnsibleModule(
argument_spec=dict(
state=dict(choices=['present', 'absent'], default='present'),
)
)
# do something fancy here
module.exit_json(changed=True, msg='it was a great success')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment