ansible-module 461 B

1234567891011121314151617181920212223
  1. # -*- mode: snippet -*-
  2. # name: ansible-module
  3. # key: ansible-module...
  4. # --
  5. from ansible.module_utils.basic import AnsibleModule
  6. def do_something():
  7. return "Something was done!"
  8. def main():
  9. module = AnsibleModule(argument_spec=dict())
  10. rc = do_something()
  11. result = {
  12. "msg": "Hello World",
  13. "rc:": rc,
  14. "failed": False,
  15. "changed": False,
  16. }
  17. module.exit_json(**result)
  18. if __name__ == "__main__":
  19. main()