Example #1
0
def main():
    argument_specs = dict(
        idp_class=dict(type=str, required=True, ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs)

    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'))
    idp_class = module.params.get("idp_class", None)
    idp = get_idp_class(idp_class)
    if not idp:
        msg = "IDP {1} not supported yet.".format(idp_class)
        return module.fail_json(msg=msg)
    avi_credentials = AviCredentials()
    avi_credentials.update_from_ansible_module(module)
    try:
        api = ApiSession.get_session(
            avi_credentials.controller, avi_credentials.username, password=avi_credentials.password,
            timeout=avi_credentials.timeout, tenant=avi_credentials.tenant,
            tenant_uuid=avi_credentials.tenant_uuid, port=avi_credentials.port, idp_class=idp)
        changed = True
    except (ConnectionError, SSLError, ChunkedEncodingError) as e:
        msg = "Error during get session {1}".format(e.message)
        return module.fail_json(msg=msg)
    return ansible_return(module, None, changed, None, api_context=api.get_context())
Example #2
0
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        gslb_name=dict(type='str', ),
        gslb_uuid=dict(type='str', ),
        name=dict(type='str', ),
        pool_name=dict(type='str', ),
        pool_uuid=dict(type='str', ),
        post_snapshot=dict(type='dict', ),
        pre_snapshot=dict(type='dict', ),
        se_group_name=dict(type='str', ),
        se_group_uuid=dict(type='str', ),
        se_name=dict(type='str', ),
        se_uuid=dict(type='str', ),
        snapshot_type=dict(type='str', ),
        statediff_operation_ref=dict(type='str', ),
        tenant_ref=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
        vs_name=dict(type='str', ),
        vs_uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'statediffsnapshot', set())
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        command=dict(type='str', required=True),
        configpb_attributes=dict(type='dict', ),
        end_time=dict(type='dict', ),
        name=dict(type='str', required=True),
        params=dict(type='list', ),
        pulse_job_id=dict(type='str', ),
        pulse_sync_status=dict(type='bool', ),
        result=dict(type='str', ),
        start_time=dict(type='dict', ),
        status=dict(type='str', ),
        tenant_ref=dict(type='str', ),
        token=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'albservicesjob', set())
def main():
    argument_specs = dict(
        state=dict(default='present',
                   choices=['absent', 'present']),
        avi_api_update_method=dict(default='put',
                                   choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str',),
        avi_patch_value=dict(type='str',),
        account_lock_timeout=dict(type='int',),
        configpb_attributes=dict(type='dict',),
        credentials_timeout_threshold=dict(type='int',),
        login_failure_count_expiry_window=dict(type='int',),
        max_concurrent_sessions=dict(type='int',),
        max_login_failure_count=dict(type='int',),
        max_password_history_count=dict(type='int',),
        name=dict(type='str', required=True),
        url=dict(type='str',),
        uuid=dict(type='str',),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(
        argument_spec=argument_specs, supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'))
    return avi_ansible_api(module, 'useraccountprofile',
                           set())
Example #5
0
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        allow_list=dict(type='dict', ),
        description=dict(type='str', ),
        ip_location_detector=dict(type='dict', required=True),
        ip_reputation_detector=dict(type='dict', required=True),
        name=dict(type='str', required=True),
        system_bot_mapping_ref=dict(type='str', ),
        system_consolidator_ref=dict(type='str', ),
        tenant_ref=dict(type='str', ),
        url=dict(type='str', ),
        user_agent_detector=dict(type='dict', required=True),
        user_bot_mapping_ref=dict(type='str', ),
        user_consolidator_ref=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'botdetectionpolicy', set())
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        app_signature_config=dict(type='dict', required=True),
        asset_contact=dict(type='dict', ),
        case_config=dict(type='dict', required=True),
        configpb_attributes=dict(type='dict', ),
        feature_opt_in_status=dict(type='dict', required=True),
        ip_reputation_config=dict(type='dict', required=True),
        mode=dict(type='str', ),
        polling_interval=dict(type='int', ),
        portal_url=dict(type='str', required=True),
        saas_licensing_config=dict(type='dict', required=True),
        split_proxy_configuration=dict(type='dict', ),
        url=dict(type='str', ),
        use_split_proxy=dict(type='bool', ),
        use_tls=dict(type='bool', ),
        user_agent_db_config=dict(type='dict', required=True),
        uuid=dict(type='str', ),
        waf_config=dict(type='dict', required=True),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'albservicesconfig', set())
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        checksum=dict(type='str', ),
        compressed=dict(type='bool', ),
        created=dict(type='str', ),
        description=dict(type='str', ),
        expires_at=dict(type='str', ),
        is_federated=dict(type='bool', ),
        name=dict(type='str', required=True),
        path=dict(type='str', ),
        read_only=dict(type='bool', ),
        restrict_download=dict(type='bool', ),
        size=dict(type='int', ),
        tenant_ref=dict(type='str', ),
        type=dict(type='str', required=True),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
        version=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'fileobject', set())
def main():
    argument_specs = dict(
        state=dict(default='present',
                   choices=['absent', 'present']),
        avi_api_update_method=dict(default='put',
                                   choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str',),
        avi_patch_value=dict(type='str',),
        ca_certs=dict(type='list',),
        configpb_attributes=dict(type='dict',),
        created_by=dict(type='str',),
        crl_check=dict(type='bool',),
        crls=dict(type='list',),
        ignore_peer_chain=dict(type='bool',),
        is_federated=dict(type='bool',),
        markers=dict(type='list',),
        name=dict(type='str', required=True),
        tenant_ref=dict(type='str',),
        url=dict(type='str',),
        uuid=dict(type='str',),
        validate_only_leaf_crl=dict(type='bool',),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(
        argument_spec=argument_specs, supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'))
    return avi_ansible_api(module, 'pkiprofile',
                           set())
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        attrs=dict(type='list', ),
        cloud_ref=dict(type='str', ),
        configpb_attributes=dict(type='dict', ),
        configured_subnets=dict(type='list', ),
        dhcp_enabled=dict(type='bool', ),
        exclude_discovered_subnets=dict(type='bool', ),
        ip6_autocfg_enabled=dict(type='bool', ),
        markers=dict(type='list', ),
        name=dict(type='str', required=True),
        synced_from_se=dict(type='bool', ),
        tenant_ref=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
        vcenter_dvs=dict(type='bool', ),
        vimgrnw_ref=dict(type='str', ),
        vrf_context_ref=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'network', set())
Example #10
0
def main():
    argument_specs = dict(
        state=dict(default='present',
                   choices=['absent', 'present']),
        avi_api_update_method=dict(default='put',
                                   choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str',),
        avi_patch_value=dict(type='str',),
        configpb_attributes=dict(type='dict',),
        controller_faults=dict(type='dict',),
        name=dict(type='str',),
        serviceengine_faults=dict(type='dict',),
        tenant_ref=dict(type='str',),
        url=dict(type='str',),
        uuid=dict(type='str',),
        virtualservice_faults=dict(type='dict',),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(
        argument_spec=argument_specs, supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'))
    return avi_ansible_api(module, 'inventoryfaultconfig',
                           set())
Example #11
0
def main():
    argument_specs = dict(
        state=dict(default='present',
                   choices=['absent', 'present']),
        avi_api_update_method=dict(default='put',
                                   choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str',),
        avi_patch_value=dict(type='str',),
        case_id=dict(type='str',),
        error=dict(type='str',),
        file_path=dict(type='str', required=True),
        name=dict(type='str', required=True),
        s3_directory=dict(type='str',),
        status=dict(type='str',),
        tenant_ref=dict(type='str',),
        url=dict(type='str',),
        uuid=dict(type='str',),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(
        argument_spec=argument_specs, supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'))
    return avi_ansible_api(module, 'albservicesfileupload',
                           set())
Example #12
0
def main():
    argument_specs = dict()
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    try:
        api_creds = AviCredentials()
        api_creds.update_from_ansible_module(module)
        api = ApiSession.get_session(api_creds.controller,
                                     api_creds.username,
                                     password=api_creds.password,
                                     timeout=api_creds.timeout,
                                     tenant=api_creds.tenant,
                                     tenant_uuid=api_creds.tenant_uuid,
                                     token=api_creds.token,
                                     port=api_creds.port)

        remote_api_version = api.remote_api_version
        remote = {}
        for key in remote_api_version.keys():
            remote[key.lower()] = remote_api_version[key]
        api.close()
        module.exit_json(changed=False, obj=remote)
    except Exception as e:
        module.fail_json(msg=("Unable to get an AVI session. %s" % e))
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        auto_disable_old_prod_pools=dict(type='bool', ),
        configpb_attributes=dict(type='dict', ),
        description=dict(type='str', ),
        evaluation_duration=dict(type='int', ),
        markers=dict(type='list', ),
        name=dict(type='str', required=True),
        rules=dict(type='list', ),
        scheme=dict(type='str', ),
        target_test_traffic_ratio=dict(type='int', ),
        tenant_ref=dict(type='str', ),
        test_traffic_ratio_rampup=dict(type='int', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
        webhook_ref=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'poolgroupdeploymentpolicy', set())
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        configpb_attributes=dict(type='dict', ),
        controller_internal_auth=dict(type='dict', ),
        is_federated=dict(type='bool', ),
        issuer=dict(type='str', ),
        jwks_keys=dict(type='str', ),
        jwt_profile_type=dict(type='str', ),
        name=dict(type='str', required=True),
        tenant_ref=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'jwtserverprofile', set())
def main():
    argument_specs = dict(
        state=dict(default='present',
                   choices=['absent', 'present']),
        avi_api_update_method=dict(default='put',
                                   choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str',),
        avi_patch_value=dict(type='str',),
        bgp_peer_labels=dict(type='list',),
        cloud_ref=dict(type='str',),
        configpb_attributes=dict(type='dict',),
        dns_info=dict(type='list',),
        east_west_placement=dict(type='bool',),
        ipam_selector=dict(type='dict',),
        markers=dict(type='list',),
        name=dict(type='str', required=True),
        tenant_ref=dict(type='str',),
        tier1_lr=dict(type='str',),
        url=dict(type='str',),
        use_standard_alb=dict(type='bool',),
        uuid=dict(type='str',),
        vip=dict(type='list',),
        vrf_context_ref=dict(type='str',),
        vsvip_cloud_config_cksum=dict(type='str',),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(
        argument_spec=argument_specs, supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'))
    return avi_ansible_api(module, 'vsvip',
                           set())
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        allocate_ip_in_vrf=dict(type='bool', ),
        aws_profile=dict(type='dict', ),
        azure_profile=dict(type='dict', ),
        configpb_attributes=dict(type='dict', ),
        custom_profile=dict(type='dict', ),
        gcp_profile=dict(type='dict', ),
        infoblox_profile=dict(type='dict', ),
        internal_profile=dict(type='dict', ),
        markers=dict(type='list', ),
        name=dict(type='str', required=True),
        oci_profile=dict(type='dict', ),
        openstack_profile=dict(type='dict', ),
        proxy_configuration=dict(type='dict', ),
        tenant_ref=dict(type='str', ),
        tencent_profile=dict(type='dict', ),
        type=dict(type='str', required=True),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'ipamdnsproviderprofile', set())
Example #17
0
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        availability_zone=dict(type='str', ),
        cloud_ref=dict(type='str', ),
        container_mode=dict(type='bool', ),
        container_type=dict(type='str', ),
        controller_created=dict(type='bool', ),
        controller_ip=dict(type='str', ),
        data_vnics=dict(type='list', ),
        enable_state=dict(type='str', ),
        flavor=dict(type='str', ),
        host_ref=dict(type='str', ),
        hypervisor=dict(type='str', ),
        mgmt_vnic=dict(type='dict', ),
        name=dict(type='str', ),
        resources=dict(type='dict', ),
        se_group_ref=dict(type='str', ),
        tenant_ref=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'serviceengine', set())
Example #18
0
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        enable_patch_rollback=dict(type='bool', ),
        enable_rollback=dict(type='bool', ),
        end_time=dict(type='str', ),
        image_ref=dict(type='str', ),
        name=dict(type='str', ),
        node_type=dict(type='str', ),
        obj_cloud_ref=dict(type='str', ),
        obj_state=dict(type='dict', ),
        patch_image_ref=dict(type='str', ),
        start_time=dict(type='str', ),
        tasks_completed=dict(type='int', ),
        tenant_ref=dict(type='str', ),
        total_tasks=dict(type='int', ),
        upgrade_ops=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
        version=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'upgradestatussummary', set())
Example #19
0
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        app_cookie_persistence_profile=dict(type='dict', ),
        configpb_attributes=dict(type='dict', ),
        description=dict(type='str', ),
        hdr_persistence_profile=dict(type='dict', ),
        http_cookie_persistence_profile=dict(type='dict', ),
        ip_persistence_profile=dict(type='dict', ),
        is_federated=dict(type='bool', ),
        markers=dict(type='list', ),
        name=dict(type='str', required=True),
        persistence_type=dict(type='str', required=True),
        server_hm_down_recovery=dict(type='str', ),
        tenant_ref=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'applicationpersistenceprofile', set())
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        cloud_ref=dict(type='str', ),
        configpb_attributes=dict(type='dict', ),
        description=dict(type='str', ),
        equivalent_labels=dict(type='list', ),
        markers=dict(type='list', ),
        name=dict(type='str', required=True),
        tenant_ref=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'prioritylabels', set())
Example #21
0
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        backup_config_ref=dict(type='str', ),
        configpb_attributes=dict(type='dict', ),
        enabled=dict(type='bool', ),
        end_date_time=dict(type='str', ),
        frequency=dict(type='int', ),
        frequency_unit=dict(type='str', ),
        name=dict(type='str', required=True),
        run_mode=dict(type='str', ),
        run_script_ref=dict(type='str', ),
        scheduler_action=dict(type='str', ),
        start_date_time=dict(type='str', ),
        tenant_ref=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'scheduler', set())
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        datetime=dict(type='str', ),
        name=dict(type='str', required=True),
        prev_target_version=dict(type='int', ),
        replication_state=dict(type='str', ),
        site_id=dict(type='str', ),
        target_timeline=dict(type='str', ),
        target_version=dict(type='int', ),
        tenant_ref=dict(type='str', ),
        timeline=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
        version=dict(type='int', ),
        version_type=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'siteversion', set())
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        action_script_config_ref=dict(type='str', ),
        autoscale_trigger_notification=dict(type='bool', ),
        configpb_attributes=dict(type='dict', ),
        description=dict(type='str', ),
        email_config_ref=dict(type='str', ),
        external_only=dict(type='bool', required=True),
        level=dict(type='str', required=True),
        name=dict(type='str', required=True),
        snmp_trap_profile_ref=dict(type='str', ),
        syslog_config_ref=dict(type='str', ),
        tenant_ref=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'actiongroupconfig', set())
Example #24
0
def main():
    argument_specs = dict(
        state=dict(default='present',
                   choices=['absent', 'present']),
        avi_api_update_method=dict(default='put',
                                   choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str',),
        avi_patch_value=dict(type='str',),
        allow_duplicate_monitors=dict(type='bool',),
        authentication=dict(type='dict',),
        configpb_attributes=dict(type='dict',),
        description=dict(type='str',),
        disable_quickstart=dict(type='bool',),
        dns_monitor=dict(type='dict',),
        external_monitor=dict(type='dict',),
        failed_checks=dict(type='int',),
        ftp_monitor=dict(type='dict',),
        ftps_monitor=dict(type='dict',),
        http_monitor=dict(type='dict',),
        https_monitor=dict(type='dict',),
        imap_monitor=dict(type='dict',),
        imaps_monitor=dict(type='dict',),
        is_federated=dict(type='bool',),
        ldap_monitor=dict(type='dict',),
        ldaps_monitor=dict(type='dict',),
        markers=dict(type='list',),
        monitor_port=dict(type='int',),
        name=dict(type='str', required=True),
        pop3_monitor=dict(type='dict',),
        pop3s_monitor=dict(type='dict',),
        radius_monitor=dict(type='dict',),
        receive_timeout=dict(type='int',),
        send_interval=dict(type='int',),
        sip_monitor=dict(type='dict',),
        smtp_monitor=dict(type='dict',),
        smtps_monitor=dict(type='dict',),
        successful_checks=dict(type='int',),
        tcp_monitor=dict(type='dict',),
        tenant_ref=dict(type='str',),
        type=dict(type='str', required=True),
        udp_monitor=dict(type='dict',),
        url=dict(type='str',),
        uuid=dict(type='str',),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(
        argument_spec=argument_specs, supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'))
    return avi_ansible_api(module, 'healthmonitor',
                           set())
def main():
    argument_specs = dict(
        full_name=dict(type='str'),
        email=dict(type='str'),
        old_password=dict(type='str', required=True, no_log=True),
        # Flag to specify priority of old/new password while establishing session with controller.
        # To handle both Saas and conventional (Entire state in playbook) scenario.
        force_change=dict(type='bool', default=False))
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    api_creds = AviCredentials()
    api_creds.update_from_ansible_module(module)
    full_name = module.params.get('full_name')
    email = module.params.get('email')
    old_password = module.params.get('old_password')
    force_change = module.params.get('force_change', False)
    data = {'old_password': old_password, 'password': api_creds.password}
    if full_name:
        data['full_name'] = full_name
    if email:
        data['email'] = email
    api = None
    if not force_change:
        # check if the new password is already set.
        try:
            api = ApiSession.get_session(api_creds.controller,
                                         api_creds.username,
                                         password=api_creds.password,
                                         timeout=api_creds.timeout,
                                         tenant=api_creds.tenant,
                                         tenant_uuid=api_creds.tenant_uuid,
                                         token=api_creds.token,
                                         port=api_creds.port)
            data['old_password'] = api_creds.password
        except Exception:
            # create a new session using the old password.
            pass
    if not api:
        api = ApiSession.get_session(api_creds.controller,
                                     api_creds.username,
                                     password=old_password,
                                     timeout=api_creds.timeout,
                                     tenant=api_creds.tenant,
                                     tenant_uuid=api_creds.tenant_uuid,
                                     token=api_creds.token,
                                     port=api_creds.port)
    rsp = api.put('useraccount', data=data)
    return ansible_return(module, rsp, True, req=data)
Example #26
0
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        ca_certs=dict(type='list', ),
        certificate=dict(type='dict', required=True),
        certificate_base64=dict(type='bool', ),
        certificate_management_profile_ref=dict(type='str', ),
        configpb_attributes=dict(type='dict', ),
        created_by=dict(type='str', ),
        dynamic_params=dict(type='list', ),
        enable_ocsp_stapling=dict(type='bool', ),
        enckey_base64=dict(type='str', ),
        enckey_name=dict(type='str', ),
        format=dict(type='str', ),
        hardwaresecuritymodulegroup_ref=dict(type='str', ),
        import_key_to_hsm=dict(type='bool', ),
        key=dict(
            type='str',
            no_log=True,
        ),
        key_base64=dict(type='bool', ),
        key_params=dict(type='dict', ),
        key_passphrase=dict(
            type='str',
            no_log=True,
        ),
        markers=dict(type='list', ),
        name=dict(type='str', required=True),
        ocsp_config=dict(type='dict', ),
        ocsp_error_status=dict(type='str', ),
        ocsp_responder_url_list_from_certs=dict(type='list', ),
        ocsp_response_info=dict(type='dict', ),
        status=dict(type='str', ),
        tenant_ref=dict(type='str', ),
        type=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'sslkeyandcertificate',
                           ['key', 'key_passphrase'])
Example #27
0
def main():
    argument_specs = dict(
        data_vnics_config=dict(type='list', ),
        se_name=dict(type='str', required=True),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(
        argument_spec=argument_specs, supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'))
    # Create controller session
    api_creds = AviCredentials()
    api_creds.update_from_ansible_module(module)
    api = ApiSession.get_session(
        api_creds.controller, api_creds.username, password=api_creds.password,
        timeout=api_creds.timeout, tenant=api_creds.tenant,
        tenant_uuid=api_creds.tenant_uuid, token=api_creds.token,
        port=api_creds.port)
    path = 'serviceengine'
    # Get existing SE object
    se_obj = api.get_object_by_name(
        path, module.params['se_name'], api_version=api_creds.api_version)
    data_vnics_config = module.params['data_vnics_config']
    for d_vnic in se_obj['data_vnics']:
        for obj in data_vnics_config:
            config_for = obj.get('if_name', None)
            if not config_for:
                return module.fail_json(msg=(
                    "if_name in a configuration is mandatory. Please provide if_name i.e. vnic's interface name."))
            if config_for == d_vnic['if_name']:
                # modify existing object
                for key, val in obj.items():
                    d_vnic[key] = val
            if config_for == d_vnic['if_name']:
                for key, val in obj.items():
                    d_vnic[key] = val
    module.params.update(se_obj)
    module.params.update(
        {
            'avi_api_update_method': 'put',
            'state': 'present'
        }
    )
    module.params.pop('data_vnics_config')
    return avi_ansible_api(module, 'serviceengine',
                           set([]))
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        aws_access_key=dict(
            type='str',
            no_log=True,
        ),
        aws_bucket_id=dict(type='str', ),
        aws_secret_access=dict(
            type='str',
            no_log=True,
        ),
        backup_file_prefix=dict(type='str', ),
        backup_passphrase=dict(
            type='str',
            no_log=True,
        ),
        configpb_attributes=dict(type='dict', ),
        maximum_backups_stored=dict(type='int', ),
        name=dict(type='str', required=True),
        remote_directory=dict(type='str', ),
        remote_file_transfer_protocol=dict(type='str', ),
        remote_hostname=dict(type='str', ),
        save_local=dict(type='bool', ),
        ssh_user_ref=dict(type='str', ),
        tenant_ref=dict(type='str', ),
        upload_to_remote_host=dict(type='bool', ),
        upload_to_s3=dict(type='bool', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(
        module, 'backupconfiguration',
        ['aws_access_key', 'aws_secret_access', 'backup_passphrase'])
Example #29
0
def main():
    argument_specs = dict(file_path=dict(type='str', required=True),
                          params=dict(type='dict'),
                          timeout=dict(type='int', default=300))
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    if not HAS_LIB:
        return module.fail_json(
            msg='avi_api_image, requests_toolbelt is required for this module')

    api_creds = AviCredentials()
    api_creds.update_from_ansible_module(module)
    api = ApiSession.get_session(api_creds.controller,
                                 api_creds.username,
                                 password=api_creds.password,
                                 timeout=api_creds.timeout,
                                 tenant=api_creds.tenant,
                                 tenant_uuid=api_creds.tenant_uuid,
                                 token=api_creds.token,
                                 port=api_creds.port)

    tenant_uuid = api_creds.tenant_uuid
    tenant = api_creds.tenant
    timeout = int(module.params.get('timeout'))
    params = module.params.get('params', None)
    # Get the api_version from module.
    api_version = api_creds.api_version
    file_path = module.params['file_path']
    if not os.path.exists(file_path):
        return module.fail_json(msg=('File not found : %s' % file_path))
    file_name = os.path.basename(file_path)
    with open(file_path, "rb") as f:
        f_data = {"file": (file_name, f, "application/octet-stream")}
        m = MultipartEncoder(fields=f_data)
        headers = {'Content-Type': m.content_type}
        rsp = api.post("image", data=m, headers=headers, verify=False)
        if rsp.status_code > 300:
            return module.fail_json(msg='Fail to upload file: %s' % rsp.text)
        else:
            return module.exit_json(changed=True,
                                    msg="File uploaded successfully")
def main():
    argument_specs = dict(
        state=dict(default='present', choices=['absent', 'present']),
        avi_api_update_method=dict(default='put', choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete', 'remove']),
        avi_patch_path=dict(type='str', ),
        avi_patch_value=dict(type='str', ),
        allow_mode_delegation=dict(type='bool', ),
        allowlist=dict(type='dict', ),
        application_signatures=dict(type='dict', ),
        bypass_static_extensions=dict(type='bool', ),
        confidence_override=dict(type='dict', ),
        configpb_attributes=dict(type='dict', ),
        created_by=dict(type='str', ),
        crs_overrides=dict(type='list', ),
        description=dict(type='str', ),
        enable_app_learning=dict(type='bool', ),
        enable_auto_rule_updates=dict(type='bool', ),
        enable_regex_learning=dict(type='bool', ),
        failure_mode=dict(type='str', ),
        geo_db_ref=dict(type='str', ),
        learning_params=dict(type='dict', ),
        markers=dict(type='list', ),
        min_confidence=dict(type='str', ),
        mode=dict(type='str', ),
        name=dict(type='str', required=True),
        paranoia_level=dict(type='str', ),
        positive_security_model=dict(type='dict', ),
        post_crs_groups=dict(type='list', ),
        pre_crs_groups=dict(type='list', ),
        tenant_ref=dict(type='str', ),
        url=dict(type='str', ),
        uuid=dict(type='str', ),
        waf_crs_ref=dict(type='str', ),
        waf_profile_ref=dict(type='str', required=True),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(argument_spec=argument_specs,
                           supports_check_mode=True)
    if not HAS_REQUESTS:
        return module.fail_json(msg=(
            'Python requests package is not installed. '
            'For installation instructions, visit https://pypi.org/project/requests.'
        ))
    return avi_ansible_api(module, 'wafpolicy', set())