def main(): argument_spec = pritunl_argument_spec() argument_spec.update( dict( organization=dict(required=True, type="str", aliases=["org"]), state=dict(required=False, choices=["present", "absent"], default="present"), user_name=dict(required=True, type="str"), user_type=dict(required=False, choices=["client", "server"], default="client"), user_email=dict(required=False, type="str", default=None), user_groups=dict(required=False, type="list", elements="str", default=None), user_disabled=dict(required=False, type="bool", default=None), user_gravatar=dict(required=False, type="bool", default=None), )), module = AnsibleModule(argument_spec=argument_spec) state = module.params.get("state") try: if state == "present": add_or_update_pritunl_user(module) elif state == "absent": remove_pritunl_user(module) except PritunlException as e: module.fail_json(msg=to_native(e))
def main(): argument_spec = pritunl_argument_spec() argument_spec.update( dict(organization=dict( required=False, type="str", default=None, aliases=["org"]))), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) try: get_pritunl_organizations(module) except PritunlException as e: module.fail_json(msg=to_native(e))
def main(): argument_spec = pritunl_argument_spec() argument_spec.update( dict( organization=dict(required=True, type="str", aliases=["org"]), user_name=dict(required=False, type="str", default=None), user_type=dict( required=False, choices=["client", "server"], default="client", ), )), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) try: get_pritunl_user(module) except PritunlException as e: module.fail_json(msg=to_native(e))
def main(): argument_spec = pritunl_argument_spec() argument_spec.update( dict( name=dict(required=True, type="str", aliases=["org"]), force=dict(required=False, type="bool", default=False), state=dict(required=False, choices=["present", "absent"], default="present"), )), module = AnsibleModule(argument_spec=argument_spec) state = module.params.get("state") try: if state == "present": add_pritunl_organization(module) elif state == "absent": remove_pritunl_organization(module) except PritunlException as e: module.fail_json(msg=to_native(e))