예제 #1
0
def main():
    module = AnsibleModule(
        argument_spec=CdpModule.argument_spec(
            name=dict(required=False, type='list', aliases=['environment']),
            current_user=dict(required=False, type='bool', aliases=['user']),
            wait=dict(required=False, type='bool', default=True),
            delay=dict(required=False, type='int', aliases=['polling_delay'], default=15),
            timeout=dict(required=False, type='int', aliases=['polling_timeout'], default=3600)
        ),
        mutually_exclusive=(
            ['name', 'current_user']
        ),
        supports_check_mode=True
    )

    result = EnvironmentUserSync(module)

    output = dict(
        changed=result.changed,
        sync=result.sync,
    )

    if result.debug:
        output.update(
            sdk_out=result.log_out,
            sdk_out_lines=result.log_lines
        )

    module.exit_json(**output)
예제 #2
0
def main():
    module = AnsibleModule(
        argument_spec=CdpModule.argument_spec(
            name=dict(required=False, type='list', elements='str', aliases=['user_name']),
            current_user=dict(required=False, type='bool'),
            filter=dict(required=False, type='dict'),
        ),
        mutually_exclusive=[
            ['name', 'current_user'],
            ['filter', 'current_user'],
            ['filter', 'name']
        ],
        supports_check_mode=True
    )

    result = IAMUserInfo(module)

    output = dict(
        changed=False,
        users=result.info,
    )

    if result.debug:
        output.update(
            sdk_out=result.log_out,
            sdk_out_lines=result.log_lines
        )

    module.exit_json(**output)
예제 #3
0
def main():
    module = AnsibleModule(
        argument_spec=CdpModule.argument_spec(
            cluster_id=dict(type='str', aliases=['id', 'name']),
            env=dict(type='str', aliases=['environment', 'env_crn']),
            overlay=dict(type='bool', default=False),
            private_load_balancer=dict(type='bool', default=False),
            az_subnet=dict(type='str'),
            az_enable_az=dict(type='bool'),
            aws_public_subnets=dict(type='list'),
            aws_private_subnets=dict(type='list'),
            state=dict(type='str', choices=['present', 'absent'], default='present'),
            force=dict(type='bool', default=False),
            wait=dict(type='bool', default=True),
            delay=dict(type='int', aliases=['polling_delay'], default=15),
            timeout=dict(type='int', aliases=['polling_timeout'], default=3600)
        ),
        required_together=[
            ['az_subnet', 'az_enable_az'],
            ['aws_public_subnets', 'aws_private_subnets']
        ],
        required_if=[
            ['state', 'absent', ['cluster_id', 'env'], True],
            ['state', 'present', ['env']]
        ],
        supports_check_mode=True
    )

    result = DwCluster(module)
    output = dict(changed=result.changed, cluster=result.cluster)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #4
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=False,
                  type='list',
                  elements='str',
                  aliases=['environment']),
        user=dict(required=False,
                  type='list',
                  elements='str',
                  aliases=['users']),
        root_certificate=dict(required=False,
                              type='bool',
                              aliases=['root_ca', 'cert'],
                              default=True),
        keytab=dict(required=False,
                    type='bool',
                    aliases=['keytabs', 'user_keytabs'],
                    default=True)),
                           supports_check_mode=True)

    result = EnvironmentAuthentication(module)

    output = dict(
        changed=False,
        authentication=result.auth,
    )

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #5
0
def main():
    module = AnsibleModule(
        argument_spec=CdpModule.argument_spec(
            name=dict(required=True, type='str', aliases=['proxyConfigName']),
            description=dict(required=False, type='str', aliases=['desc']),
            host=dict(required=False, type='str'),
            port=dict(required=False, type='int'),
            protocol=dict(required=False, type='str'),
            user=dict(required=False, type='str'),
            password=dict(required=False, type='str', no_log=True),
            state=dict(required=False,
                       type='str',
                       choices=['present', 'absent'],
                       default='present')),
        required_if=[
            ['state', 'present', ('host', 'port', 'protocol'), False],
        ],
        # TODO Support check mode
        supports_check_mode=False)

    result = EnvironmentProxy(module)

    output = dict(
        changed=result.changed,
        proxy=result.proxy_config,
    )

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #6
0
def main():
    module = AnsibleModule(
        argument_spec=CdpModule.argument_spec(
            name=dict(required=True, type='str', aliases=['datahub']),
            state=dict(required=False, type='str', choices=['present', 'absent'], default='present'),
            definition=dict(required=False, type='str'),
            subnet=dict(required=False, type='str', default=None),
            image=dict(required=False, type='str', default=None),
            catalog=dict(required=False, type='str', default=None),
            template=dict(required=False, type='str', default=None),
            groups=dict(required=False, type='list', default=None),
            environment=dict(required=False, type='str', aliases=['env'], default=None),
            tags=dict(required=False, type='dict', aliases=['datahub_tags']),

            force=dict(required=False, type='bool', default=False),
            wait=dict(required=False, type='bool', default=True),
            delay=dict(required=False, type='int', aliases=['polling_delay'], default=15),
            timeout=dict(required=False, type='int', aliases=['polling_timeout'], default=3600)
        ),
        supports_check_mode=True
        #Punting on additional checks here. There are a variety of supporting datahub invocations that can make this more complex
        #required_together=[
        #    ['subnet', 'image', 'catalog', 'template', 'groups', 'environment'],
        #]
    )

    result = DatahubCluster(module)
    output = dict(changed=result.changed, datahub=result.datahub)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #7
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        catalog_id=dict(type='str', aliases=['id']),
        cluster_id=dict(required=True, type='str'),
        name=dict(type='str'),
        load_demo_data=dict(type='bool'),
        state=dict(type='str',
                   choices=['present', 'absent'],
                   default='present'),
        wait=dict(type='bool', default=True),
        delay=dict(type='int', aliases=['polling_delay'], default=15),
        timeout=dict(type='int', aliases=['polling_timeout'], default=3600)),
                           required_if=[
                               ['state', 'present', ['name']],
                               ['state', 'absent', ['name', 'id'], True],
                           ],
                           mutually_exclusive=[['name', 'id']],
                           supports_check_mode=True)

    result = DwDatabaseCatalog(module)
    output = dict(changed=result.changed,
                  database_catalog=result.database_catalog)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #8
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=True, type='str', aliases=['database']),
        environment=dict(required=True, type='str', aliases=['env']),
        state=dict(required=False,
                   type='str',
                   choices=['present', 'absent'],
                   default='present'),
        wait=dict(required=False, type='bool', default=True),
        delay=dict(required=False,
                   type='int',
                   aliases=['polling_delay'],
                   default=15),
        timeout=dict(required=False,
                     type='int',
                     aliases=['polling_timeout'],
                     default=3600)),
                           supports_check_mode=True)

    result = OpdbDatabase(module)
    output = dict(changed=False, databases=result.databases)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #9
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        env_crn=dict(type='str'),
        df_crn=dict(type='str'),
        nodes_min=dict(type='int', default=3, aliases=['min_k8s_node_count']),
        nodes_max=dict(type='int', default=3, aliases=['max_k8s_node_count']),
        public_loadbalancer=dict(type='bool',
                                 default=False,
                                 aliases=['use_public_load_balancer']),
        loadbalancer_ip_ranges=dict(type='list', elements='str', default=None),
        kube_ip_ranges=dict(type='list', elements='str', default=None),
        cluster_subnets=dict(type='list', elements='str', default=None),
        loadbalancer_subnets=dict(type='list', elements='str', default=None),
        persist=dict(type='bool', default=False),
        terminate=dict(type='bool', default=False),
        state=dict(type='str',
                   choices=['present', 'absent'],
                   default='present'),
        force=dict(type='bool', default=False, aliases=['force_delete']),
        wait=dict(type='bool', default=True),
        delay=dict(type='int', aliases=['polling_delay'], default=15),
        timeout=dict(type='int', aliases=['polling_timeout'], default=3600)),
                           supports_check_mode=True,
                           required_if=[
                               ('state', 'present', ('env_crn', ), False),
                               ('state', 'absent', ('df_crn', ), False)
                           ])

    result = DFService(module)
    output = dict(changed=False, service=result.service)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #10
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=True, type='str', aliases=['environment'])),
                           supports_check_mode=True)

    result = FreeIPAInfo(module)
    output = dict(changed=False, environments=result.freeipa)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(default=dict(
        required=False, type='bool', default=False), ),
                           supports_check_mode=True)

    result = DatalakeRuntimeInfo(module)
    output = dict(changed=False, versions=result.versions)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #12
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        cluster_id=dict(type='str', aliases=['id']),
        environment=dict(type='str', aliases=['env'])),
                           mutually_exclusive=[['cluster_id', 'environment']],
                           supports_check_mode=True)

    result = DwClusterInfo(module)
    output = dict(changed=False, clusters=result.clusters)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #13
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=False, type='str', aliases=['database']),
        environment=dict(required=False, type='str', aliases=['env'])),
                           required_by={'name': ('environment')},
                           supports_check_mode=True)

    result = OpdbDatabaseInfo(module)
    output = dict(changed=False, databases=result.databases)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #14
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(),
                           supports_check_mode=True)

    result = AccountAuthenticationInfo(module)

    output = dict(
        changed=False,
        account=result.account,
    )

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #15
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=False, type='str', aliases=['proxyConfigName'])),
                           supports_check_mode=True)

    result = EnvironmentProxyInfo(module)
    output = dict(
        changed=False,
        proxies=result.proxy_configs,
    )

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=False, type='str'),
        environment=dict(required=True, type='str', aliases=['env']),
        service_name=dict(required=True, type='str',
                          aliases=['cluster_name'])),
                           supports_check_mode=True)

    result = DEVirtualClusterInfo(module)
    output = dict(changed=False, vcs=result.vcs)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #17
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=False, type='str'),
        df_crn=dict(required=False, type='str'),
        env_crn=dict(required=False, type='str'),
    ),
                           supports_check_mode=True,
                           mutually_exclusive=['name', 'df_crn', 'env_crn'])

    result = DFInfo(module)
    output = dict(changed=False, services=result.services)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=False, type='str', aliases=['definition', 'crn']),
        content=dict(required=False,
                     type='bool',
                     default=False,
                     aliases=['definition_content'])),
                           supports_check_mode=True)

    result = DatahubDefinitionInfo(module)
    output = dict(changed=False, definitions=result.definitions)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #19
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(name=dict(
        required=False, type='list', elements='str', aliases=['group_name'])),
                           supports_check_mode=True)

    result = IAMGroupInfo(module)

    output = dict(
        changed=False,
        groups=result.info,
    )

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
def main():
    module = AnsibleModule(
        argument_spec=CdpModule.argument_spec(
            warehouse_id=dict(type='str', aliases=['vw_id', 'id']),
            cluster_id=dict(required=True, type='str'),
            catalog_id=dict(type='str', aliases=['dbc_id']),
            type = dict(type='str'),
            name = dict(type='str'),
            template=dict(type='str', choices=['xsmall', 'small', 'medium', 'large']),
            autoscaling_min_nodes=dict(type='int'),
            autoscaling_max_nodes=dict(type='int'),
            common_configs=dict(type='dict', options=dict(
                configBlocks = dict(type='list', elements='dict', options=dict(
                    id=dict(type='str'),
                    format=dict(type='str', choices=['HADOOP_XML', 'PROPERTIES', 'TEXT', 'JSON', 'BINARY', 'ENV', 'FLAGFILE']),
                    content=dict(type='dict', options=dict(
                        keyValues=dict(type='dict'),
                        text=dict(type='str'),
                        json=dict(type='json')
                    ))
                ))
            )),
            application_configs=dict(type='dict'),
            ldap_groups=dict(type='list'),
            enable_sso=dict(type='bool', default=False),
            tags=dict(type='dict'),
            state=dict(type='str', choices=['present', 'absent'], default='present'),
            wait = dict(type='bool', default=True),
            delay = dict(type='int', aliases=['polling_delay'], default=15),
            timeout = dict(type='int', aliases=['polling_timeout'], default=3600)
        ),
        required_if=[
            ['state', 'absent', ['warehouse_id']],
            ['state', 'present', ['catalog_id', 'type', 'name']]
        ],
        supports_check_mode=True
    )

    result = DwVirtualWarehouse(module)
    output = dict(changed=result.changed, virtual_warehouse=result.virtual_warehouse)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
def main():
    module = AnsibleModule(
        argument_spec=CdpModule.argument_spec(
            catalog_id=dict(type='str', aliases=['id']),
            cluster_id=dict(required=True, type='str'),
            name = dict(type='str'),
        ),
        mutually_exclusive=[['id', 'name']],
        supports_check_mode=True
    )

    result = DwDatabaseCatalogInfo(module)
    output = dict(changed=False, database_catalogs=result.database_catalogs)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #22
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=True, type='str', aliases=['environment']),
        workload_analytics=dict(required=False,
                                type='bool',
                                aliases=['analytics']),
        logs_collection=dict(required=False,
                             type='bool',
                             aliases=['logs', 'report_deployment_logs'])),
                           supports_check_mode=True)

    result = EnvironmentTelemetry(module)
    output = dict(changed=True)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #23
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        cloud=dict(required=True,
                   type='str',
                   aliases=['cloud_platform'],
                   choices=['aws', 'azure'])),
                           supports_check_mode=True)

    result = AccountCredentialInfo(module)

    output = dict(
        changed=False,
        prerequisites=result.prerequisites,
    )

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #24
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=True, type='str', aliases=['environment']),
        data_access=dict(required=False,
                         type='str',
                         aliases=['data_access_arn', 'data']),
        ranger_audit=dict(required=False,
                          type='str',
                          aliases=['ranger_audit_arn', 'audit']),
        ranger_cloud_access=dict(required=False,
                                 type='str',
                                 aliases=['ranger_cloud_access_arn', 'cloud']),
        mappings=dict(required=False,
                      type='list',
                      elements=dict,
                      options=dict(accessor=dict(required=True,
                                                 type='str',
                                                 aliases=['accessorCrn']),
                                   role=dict(required=True,
                                             type='str',
                                             aliases=['roleCrn']))),
        clear_mappings=dict(required=False,
                            type='bool',
                            default=False,
                            aliases=['set_empty_mappings']),
        sync=dict(required=False,
                  type='bool',
                  default=True,
                  aliases=['sync_mappings'])),
                           mutually_exclusive=[['mappings', 'clear_mappings']],
                           supports_check_mode=True)

    result = EnvironmentIdBroker(module)

    output = dict(
        changed=result.changed,
        mappings=result.idbroker,
    )

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #25
0
def main():
    module = AnsibleModule(
        argument_spec=CdpModule.argument_spec(
            warehouse_id=dict(type='str', aliases=['vw_id', 'id']),
            cluster_id=dict(required=True, type='str'),
            catalog_id=dict(type='str', aliases=['dbc_id']),
            name=dict(type='str'),
            delay=dict(type='int', aliases=['polling_delay'], default=15),
            timeout=dict(type='int', aliases=['polling_timeout'],
                         default=3600)),
        mutually_exclusive=[['warehouse_id', 'name', 'catalog_id']],
        supports_check_mode=True)

    result = DwVirtualWarehouseInfo(module)
    output = dict(changed=False, virtual_warehouses=result.virtual_warehouses)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #26
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        state=dict(required=False,
                   type='str',
                   choices=['present', 'absent'],
                   default='present'),
        name=dict(required=True, type='str', aliases=['group_name']),
        sync=dict(required=False,
                  type='bool',
                  aliases=['sync_membership', 'sync_on_login']),
        users=dict(required=False, type='list', elements='str'),
        roles=dict(required=False, type='list', elements='str'),
        resource_roles=dict(required=False,
                            type='list',
                            elements='dict',
                            options=dict(resource=dict(required=True,
                                                       type='str',
                                                       aliases=['resourceCrn'
                                                                ]),
                                         role=dict(required=True,
                                                   type='str',
                                                   aliases=['resourceRoleCrn'
                                                            ])),
                            aliases=['assignments']),
        purge=dict(required=False,
                   type='bool',
                   default=False,
                   aliases=['replace'])),
                           supports_check_mode=True)

    result = IAMGroup(module)

    output = dict(
        changed=result.changed,
        group=result.info,
    )

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #27
0
def main():
    module = AnsibleModule(
        argument_spec=CdpModule.argument_spec(
            name=dict(required=True, type='str', aliases=['operation_id'])
        ),
        supports_check_mode=True
    )

    result = EnvironmentUserSyncInfo(module)

    output = dict(
        changed=result.changed,
        sync=result.sync,
    )

    if result.debug:
        output.update(
            sdk_out=result.log_out,
            sdk_out_lines=result.log_lines
        )

    module.exit_json(**output)
예제 #28
0
def main():
    module = AnsibleModule(
        argument_spec=CdpModule.argument_spec(
            name=dict(required=False, type='list', elements='str', aliases=['environment']),
            password=dict(required=True, type='str', no_log=True, aliases=['workload_password'])
        ),
        supports_check_mode=True
    )

    result = EnvironmentAuthentication(module)

    output = dict(
        changed=result.changed
    )

    if result.debug:
        output.update(
            sdk_out=result.log_out,
            sdk_out_lines=result.log_lines
        )

    module.exit_json(**output)
예제 #29
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        enable_sso=dict(required=False,
                        type='bool',
                        aliases=['sso', 'enable_cloudera_sso']),
        password_lifetime=dict(required=False,
                               type='int',
                               no_log=False,
                               aliases=['workload_password_lifetime'])),
                           supports_check_mode=True)

    result = AccountAuthentication(module)

    output = dict(
        changed=result.changed,
        account=result.account,
    )

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)
예제 #30
0
def main():
    module = AnsibleModule(argument_spec=CdpModule.argument_spec(
        name=dict(required=True, type='str', aliases=['datalake']),
        state=dict(required=False,
                   type='str',
                   choices=['present', 'absent'],
                   default='present'),
        instance_profile=dict(required=False,
                              type='str',
                              aliases=['managed_identity']),
        storage=dict(required=False,
                     type='str',
                     aliases=['storage_location', 'storage_location_base']),
        environment=dict(required=False, type='str', aliases=['env']),
        runtime=dict(required=False, type='str'),
        scale=dict(required=False,
                   type='str',
                   choices=['LIGHT_DUTY', 'MEDIUM_DUTY_HA']),
        tags=dict(required=False, type='dict', aliases=['datalake_tags']),
        force=dict(required=False, type='bool', default=False),
        wait=dict(required=False, type='bool', default=True),
        delay=dict(required=False,
                   type='int',
                   aliases=['polling_delay'],
                   default=15),
        timeout=dict(required=False,
                     type='int',
                     aliases=['polling_timeout'],
                     default=3600)),
                           supports_check_mode=True)

    result = Datalake(module)
    output = dict(changed=result.changed, datalake=result.datalake)

    if result.debug:
        output.update(sdk_out=result.log_out, sdk_out_lines=result.log_lines)

    module.exit_json(**output)