def main(): additional_argument_spec = { "service_host": dict(required=True, type="str"), "service_port": dict(required=False, type="int", default=25107), "service_ssl_flag": dict(required=False, type="bool", default=False), "service_type": dict(required=False, type="str", choices=["disk", "blob", "proxy"], default="disk") } filter_property = "service_host" filter_value_module_parameter = "service_host" module_parameter_to_service_parameter_map = { "service_port": "service_port", "service_ssl_flag": "service_ssl_flag", "service_type": "service_type" } process("keep_services", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_service_parameter_map)
def main(): additional_argument_spec={ "uuid": dict(required=True, type="str"), "owner_uuid": dict(required=True, type="str"), "name": dict(required=True, type="str"), } filter_property = "uuid" filter_value_module_parameter = "uuid" module_parameter_to_resource_parameter_map = { "owner_uuid": "owner_uuid", "name": "name", } process("groups", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_resource_parameter_map)
def main(): additional_argument_spec={ "hostname": dict(required=True, type="str"), "uuid": dict(required=False, type="str"), "owner_uuid": dict(required=False, type="str", default=None), } filter_property = "uuid" filter_value_module_parameter = "uuid" module_parameter_to_service_parameter_map = { "hostname": "hostname", "owner_uuid": "owner_uuid" } process("virtual_machines", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_service_parameter_map)
def main(): additional_argument_spec={ "uuid": dict(required=True, type="str"), "owner_uuid": dict(required=True, type="str"), "name": dict(required=True, type="str"), } filter_property = "uuid" filter_value_module_parameter = "uuid" module_parameter_to_resource_parameter_map = { "owner_uuid": "owner_uuid", "name": "name", } process("repositories", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_resource_parameter_map)
def main(): additional_argument_spec={ "uuid": dict(required=True, type="str"), "scopes": dict(required=False, type="list", default=['all']), "client_token": dict(required=True, type="str"), } filter_property = "uuid" filter_value_module_parameter = "uuid" module_parameter_to_resource_parameter_map = { "scopes": "scopes", "client_token": "api_token", } process("api_client_authorizations", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_resource_parameter_map)
def main(): additional_argument_spec = { "hostname": dict(required=True, type="str"), "uuid": dict(required=False, type="str"), "owner_uuid": dict(required=False, type="str", default=None), } filter_property = "uuid" filter_value_module_parameter = "uuid" module_parameter_to_service_parameter_map = { "hostname": "hostname", "owner_uuid": "owner_uuid" } process("virtual_machines", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_service_parameter_map)
def main(): additional_argument_spec = { "uuid": dict(required=True, type="str"), "scopes": dict(required=False, type="list", default=['all']), "client_token": dict(required=True, type="str"), } filter_property = "uuid" filter_value_module_parameter = "uuid" module_parameter_to_resource_parameter_map = { "scopes": "scopes", "client_token": "api_token", } process("api_client_authorizations", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_resource_parameter_map)
def main(): additional_argument_spec = { "service_host": dict(required=True, type="str"), "service_port": dict(required=False, type="int", default=25107), "service_ssl_flag": dict(required=False, type="bool", default=False), "service_type": dict(required=False, type="str", choices=["disk", "blob", "proxy"], default="disk") } filter_property = "service_host" filter_value_module_parameter = "service_host" module_parameter_to_service_parameter_map = { "service_port": "service_port", "service_ssl_flag": "service_ssl_flag", "service_type": "service_type" } process("keep_services", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_service_parameter_map)
def main(): additional_argument_spec={ "uuid": dict(required=True, type="str"), "head_uuid": dict(required=True, type="str"), "tail_uuid": dict(required=True, type="str"), "link_class": dict(required=True, type="str"), "name": dict(required=True, type="str"), } filter_property = "uuid" filter_value_module_parameter = "uuid" module_parameter_to_resource_parameter_map = { "head_uuid": "head_uuid", "tail_uuid": "tail_uuid", "link_class": "link_class", "name": "name", } process("links", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_resource_parameter_map)
def main(): additional_argument_spec={ "uuid": dict(required=True, type="str"), "name": dict(required=True, type="str"), "key_type": dict(required=False, type="str", default="SSH"), "authorized_user_uuid": dict(required=True, type="str"), "public_key": dict(required=True, type="str"), } filter_property = "uuid" filter_value_module_parameter = "uuid" module_parameter_to_resource_parameter_map = { "name": "name", "key_type": "key_type", "authorized_user_uuid": "authorized_user_uuid", "public_key": "public_key", } process("authorized_keys", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_resource_parameter_map)
def main(): additional_argument_spec = { "uuid": dict(required=True, type="str"), "name": dict(required=True, type="str"), "key_type": dict(required=False, type="str", default="SSH"), "authorized_user_uuid": dict(required=True, type="str"), "public_key": dict(required=True, type="str"), } filter_property = "uuid" filter_value_module_parameter = "uuid" module_parameter_to_resource_parameter_map = { "name": "name", "key_type": "key_type", "authorized_user_uuid": "authorized_user_uuid", "public_key": "public_key", } process("authorized_keys", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_resource_parameter_map)
def main(): additional_argument_spec = { "uuid": dict(required=True, type="str"), "head_uuid": dict(required=True, type="str"), "tail_uuid": dict(required=True, type="str"), "link_class": dict(required=True, type="str"), "name": dict(required=True, type="str"), } filter_property = "uuid" filter_value_module_parameter = "uuid" module_parameter_to_resource_parameter_map = { "head_uuid": "head_uuid", "tail_uuid": "tail_uuid", "link_class": "link_class", "name": "name", } process("links", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_resource_parameter_map)
def main(): additional_argument_spec={ UUID_PARAMETER: dict(required=True, type="str"), HOSTNAME_PARAMETER: dict(required=True, type="str"), DOMAIN_PARAMETER: dict(required=True, type="str"), INFO_PARAMETER: dict(required=False, type="dict", default=None, no_log=True), MERGE_INFO_PARAMETER: dict(required=False, type="bool", default=True) } filter_property = "uuid" filter_value_module_parameter = UUID_PARAMETER module_parameter_to_resource_parameter_map = { HOSTNAME_PARAMETER: "hostname", DOMAIN_PARAMETER: "domain", INFO_PARAMETER: "info" } # To allow handling of other properties in `info` that we do not care about, e.g. # `{"ping_secret": "<secret>", "slurm_state": "idle"}` def merge_info_required_value_modifier(value, existing_value): if not isinstance(existing_value, dict): return value merged_value = existing_value.copy() merged_value.update(value) return merged_value merge_other_info = AnsibleModule(additional_argument_spec, bypass_checks=True, check_invalid_arguments=False).params[MERGE_INFO_PARAMETER] if merge_other_info: required_value_modifier = merge_info_required_value_modifier else: required_value_modifier = default_value_equator process("nodes", additional_argument_spec, filter_property, filter_value_module_parameter, module_parameter_to_resource_parameter_map, required_value_modifier)