def main(): module = AnsibleModule(argument_spec=dict( allowed=dict(type='list', required=True), location=dict(type='str', default='/etc/network/interfaces.d/')), ) module.custom_currentportlist = [] module.custom_allowedportlist = [] module.changed = False module.msg = 'configured port list is part of allowed port list' read_current_int_dir(module) convert_allowed_list_to_port_range(module) if int_policy_enforce(module): module.changed = True unconfigure_interfaces(module) module.exit_json(changed=module.changed, msg=module.msg)
def main(): module = AnsibleModule( argument_spec=dict( allowed=dict(type='list', required=True), location=dict(type='str', default='/etc/network/interfaces.d/') ), ) module.custom_currentportlist = [] module.custom_allowedportlist = [] module.changed = False module.msg = 'configured port list is part of allowed port list' read_current_int_dir(module) convert_allowed_list_to_port_range(module) if int_policy_enforce(module): module.changed = True unconfigure_interfaces(module) module.exit_json(changed=module.changed, msg=module.msg)
def main(): module = AnsibleModule(argument_spec=dict(src=dict(required=True, type='str'), force=dict(type='bool', default=False)), ) # check if license is installed # if force is enabled then set return code to nonzero if module.params.get('force') is True: _rc = 10 else: (_rc, out, _err) = module.run_command(CL_LICENSE_PATH) if _rc == 0: module.msg = "No change. License already installed" module.changed = False else: install_license(module) module.msg = "License installation completed" module.changed = True module.exit_json(changed=module.changed, msg=module.msg)