community.kubernetes.helm (1.2.1) — module

Manages Kubernetes packages with the Helm package manager

| "added in version" 0.11.0 of community.kubernetes"

Authors: Lucas Boisserie (@LucasBoisserie), Matthieu Diehr (@d-matt)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install community.kubernetes:==1.2.1


Add to requirements.yml

  collections:
    - name: community.kubernetes
      version: 1.2.1

Description

Install, upgrade, delete packages with the Helm package manager.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy latest version of Prometheus chart inside monitoring namespace (and create it)
  community.kubernetes.helm:
    name: test
    chart_ref: stable/prometheus
    release_namespace: monitoring
    create_namespace: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# From repository
- name: Add stable chart repo
  community.kubernetes.helm_repository:
    name: stable
    repo_url: "https://kubernetes.github.io/ingress-nginx"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy latest version of Grafana chart inside monitoring namespace with values
  community.kubernetes.helm:
    name: test
    chart_ref: stable/grafana
    release_namespace: monitoring
    values:
      replicas: 2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy Grafana chart on 5.0.12 with values loaded from template
  community.kubernetes.helm:
    name: test
    chart_ref: stable/grafana
    chart_version: 5.0.12
    values: "{{ lookup('template', 'somefile.yaml') | from_yaml }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy Grafana chart using values files on target
  community.kubernetes.helm:
    name: test
    chart_ref: stable/grafana
    release_namespace: monitoring
    values_files:
      - /path/to/values.yaml
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove test release and waiting suppression ending
  community.kubernetes.helm:
    name: test
    state: absent
    wait: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# From git
- name: Git clone stable repo on HEAD
  ansible.builtin.git:
    repo: "http://github.com/helm/charts.git"
    dest: /tmp/helm_repo
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy Grafana chart from local path
  community.kubernetes.helm:
    name: test
    chart_ref: /tmp/helm_repo/stable/grafana
    release_namespace: monitoring
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# From url
- name: Deploy Grafana chart on 5.6.0 from url
  community.kubernetes.helm:
    name: test
    chart_ref: "https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz"
    release_namespace: monitoring

Inputs

    
host:
    description:
    - Provide a URL for accessing the API. Can also be specified via C(K8S_AUTH_HOST)
      environment variable.
    type: str
    version_added: 1.2.0
    version_added_collection: community.kubernetes

wait:
    default: false
    description:
    - Wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment
      are in a ready state before marking the release as successful.
    type: bool

force:
    default: false
    description:
    - Helm option to force reinstall, ignore on new install.
    type: bool

purge:
    default: true
    description:
    - Remove the release from the store and make its name free for later use.
    type: bool

atomic:
    default: false
    description:
    - If set, the installation process deletes the installation on failure.
    type: bool

api_key:
    description:
    - Token used to authenticate with the API. Can also be specified via C(K8S_AUTH_API_KEY)
      environment variable.
    type: str
    version_added: 1.2.0
    version_added_collection: community.kubernetes

ca_cert:
    aliases:
    - ssl_ca_cert
    description:
    - Path to a CA certificate used to authenticate with the API. The full certificate
      chain must be provided to avoid certificate validation errors. Can also be specified
      via C(K8S_AUTH_SSL_CA_CERT) environment variable.
    type: path
    version_added: 1.2.0
    version_added_collection: community.kubernetes

context:
    aliases:
    - kube_context
    description:
    - Helm option to specify which kubeconfig context to use.
    - If the value is not specified in the task, the value of environment variable C(K8S_AUTH_CONTEXT)
      will be used instead.
    type: str

replace:
    default: false
    description:
    - Reuse the given name, only if that name is a deleted release which remains in the
      history.
    - This is unsafe in production environment.
    type: bool
    version_added: 1.11.0
    version_added_collection: community.kubernetes

chart_ref:
    description:
    - chart_reference on chart repository.
    - path to a packaged chart.
    - path to an unpacked chart directory.
    - absolute URL.
    - Required when I(release_state) is set to C(present).
    required: false
    type: path

skip_crds:
    default: false
    description:
    - Skip custom resource definitions when installing or upgrading.
    type: bool
    version_added: 1.2.0
    version_added_collection: community.kubernetes

kubeconfig:
    aliases:
    - kubeconfig_path
    description:
    - Helm option to specify kubeconfig path to use.
    - If the value is not specified in the task, the value of environment variable C(K8S_AUTH_KUBECONFIG)
      will be used instead.
    type: path

binary_path:
    description:
    - The path of a helm binary to use.
    required: false
    type: path

disable_hook:
    default: false
    description:
    - Helm option to disable hook on install/upgrade/delete.
    type: bool

release_name:
    aliases:
    - name
    description:
    - Release name to manage.
    required: true
    type: str

values_files:
    default: []
    description:
    - Value files to pass to chart.
    - Paths will be read from the target host's filesystem, not the host running ansible.
    - values_files option is evaluated before values option if both are used.
    - Paths are evaluated in the order the paths are specified.
    elements: str
    required: false
    type: list
    version_added: 1.1.0
    version_added_collection: community.kubernetes

wait_timeout:
    description:
    - Timeout when wait option is enabled (helm2 is a number of seconds, helm3 is a duration).
    type: str

chart_version:
    description:
    - Chart version to install. If this is not specified, the latest version is installed.
    required: false
    type: str

release_state:
    aliases:
    - state
    choices:
    - present
    - absent
    default: present
    description:
    - Desirated state of release.
    required: false
    type: str

chart_repo_url:
    description:
    - Chart repository URL where to locate the requested chart.
    required: false
    type: str

release_values:
    aliases:
    - values
    default: {}
    description:
    - Value to pass to chart.
    required: false
    type: dict

validate_certs:
    aliases:
    - verify_ssl
    default: true
    description:
    - Whether or not to verify the API server's SSL certificates. Can also be specified
      via C(K8S_AUTH_VERIFY_SSL) environment variable.
    type: bool
    version_added: 1.2.0
    version_added_collection: community.kubernetes

create_namespace:
    default: false
    description:
    - Create the release namespace if not present.
    type: bool
    version_added: 0.11.1
    version_added_collection: community.kubernetes

release_namespace:
    aliases:
    - namespace
    description:
    - Kubernetes namespace where the chart should be installed.
    required: true
    type: str

update_repo_cache:
    default: false
    description:
    - Run C(helm repo update) before the operation. Can be run as part of the package
      installation or as a separate step.
    type: bool

Outputs

command:
  description: Full `helm` command built by this module, in case you want to re-run
    the command outside the module or debug a problem.
  returned: always
  sample: helm upgrade ...
  type: str
status:
  contains:
    appversion:
      description: Version of app deployed
      returned: always
      type: str
    chart:
      description: Chart name and chart version
      returned: always
      type: str
    name:
      description: Name of the release
      returned: always
      type: str
    namespace:
      description: Namespace where the release is deployed
      returned: always
      type: str
    revision:
      description: Number of time where the release has been updated
      returned: always
      type: str
    status:
      description: Status of release (can be DEPLOYED, FAILED, ...)
      returned: always
      type: str
    updated:
      description: The Date of last update
      returned: always
      type: str
    values:
      description: Dict of Values used to deploy
      returned: always
      type: str
  description: A dictionary of status output
  returned: on success Creation/Upgrade/Already deploy
  type: complex
stderr:
  description: Full `helm` command stderr, in case you want to display it or examine
    the event log
  returned: always
  sample: ''
  type: str
stdout:
  description: Full `helm` command stdout, in case you want to display it or examine
    the event log
  returned: always
  sample: ''
  type: str