community.digitalocean.digital_ocean_kubernetes_info (1.26.0) — module

Returns information about an existing DigitalOcean Kubernetes cluster

| "added in version" 1.3.0 of community.digitalocean"

Authors: Mark Mercado (@mamercad)

Install collection

Install with ansible-galaxy collection install community.digitalocean:==1.26.0


Add to requirements.yml

  collections:
    - name: community.digitalocean
      version: 1.26.0

Description

Returns information about an existing DigitalOcean Kubernetes cluster.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get information about an existing DigitalOcean Kubernetes cluster
  community.digitalocean.digital_ocean_kubernetes_info:
    oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
    name: hacktoberfest
    return_kubeconfig: true
  register: my_cluster
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- ansible.builtin.debug:
    msg: "Cluster name is {{ my_cluster.data.name }}, ID is {{ my_cluster.data.id }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- ansible.builtin.debug:
    msg: "Cluster kubeconfig is {{ my_cluster.data.kubeconfig }}"

Inputs

    
name:
    description:
    - A human-readable name for a Kubernetes cluster.
    required: true
    type: str

oauth_token:
    aliases:
    - API_TOKEN
    description:
    - DigitalOcean OAuth token; can be specified in C(DO_API_KEY), C(DO_API_TOKEN), or
      C(DO_OAUTH_TOKEN) environment variables
    required: true
    type: str

return_kubeconfig:
    default: false
    description:
    - Controls whether or not to return the C(kubeconfig).
    required: false
    type: bool

Outputs

data:
  description: A DigitalOcean Kubernetes cluster (and optional C(kubeconfig))
  returned: changed
  sample:
    auto_upgrade: false
    cluster_subnet: 10.244.0.0/16
    created_at: '2020-09-26T21:36:18Z'
    endpoint: https://REDACTED.k8s.ondigitalocean.com
    id: REDACTED
    ipv4: REDACTED
    kubeconfig: "apiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data:\
      \ REDACTED\n    server: https://REDACTED.k8s.ondigitalocean.com\n  name: do-nyc1-hacktoberfest\n\
      contexts:\n- context:\n    cluster: do-nyc1-hacktoberfest\n    user: do-nyc1-hacktoberfest-admin\n\
      \  name: do-nyc1-hacktoberfest\ncurrent-context: do-nyc1-hacktoberfest\nkind:\
      \ Config\npreferences: {}\nusers:\n- name: do-nyc1-hacktoberfest-admin\n  user:\n\
      \    token: REDACTED"
    maintenance_policy:
      day: any
      duration: 4h0m0s
      start_time: '13:00'
    name: hacktoberfest
    node_pools:
    - auto_scale: false
      count: 1
      id: REDACTED
      labels: null
      max_nodes: 0
      min_nodes: 0
      name: hacktoberfest-workers
      nodes:
      - created_at: '2020-09-26T21:36:18Z'
        droplet_id: REDACTED
        id: REDACTED
        name: hacktoberfest-workers-3tv46
        status:
          state: running
        updated_at: '2020-09-26T21:40:28Z'
      size: s-1vcpu-2gb
      tags:
      - k8s
      - k8s:REDACTED
      - k8s:worker
      taints: []
    region: nyc1
    service_subnet: 10.245.0.0/16
    status:
      state: running
    surge_upgrade: false
    tags:
    - k8s
    - k8s:REDACTED
    updated_at: '2020-09-26T21:42:29Z'
    version: 1.18.8-do.0
    vpc_uuid: REDACTED
  type: dict