skupper.v2.resource module – Place skupper resources (yaml) in the provided namespace

Note

This module is part of the skupper.v2 collection (version 2.2.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install skupper.v2. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: skupper.v2.resource.

New in skupper.v2 2.0.0

Synopsis

  • Place skupper resources (yaml) in the provided namespace. If platform is kubernetes (default) the resources are applied to the respective namespace. In case a different platform is used, the resources will be placed into the correct location for the namespace on the file system.

Note

This module has a corresponding action plugin.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 3.9

  • kubernetes >= 24.2.0

  • PyYAML >= 3.11

Parameters

Parameter

Comments

context

string

The name of a context found in the config file.

def

aliases: definition

string

YAML representation of a custom resource.

It can contain multiple YAML documents.

kubeconfig

string

Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config.

namespace

string

Use to specify an object namespace.

path

string

Path where resources are located (yaml and yml files).

Path can be a directory, a file or an http URL.

If remote is true (default is false), the resources will not be copied from the control node.

URLs are always fetch from the inventory host.

Mutually exclusive with def

platform

string

The platform to use when manipulating resources

Choices:

  • "kubernetes" ← (default)

  • "podman"

  • "docker"

  • "linux"

redeem

boolean

For non-kubernetes platforms (for example podman, docker, or linux), redeem AccessToken documents without keeping them in the namespace; only Secret and Link are applied.

Other documents in the same definition are applied first. With spec.url and spec.code, uses HTTP (as skupper token redeem).

When platform is kubernetes, this option is ignored and a warning is issued; the Skupper V2 controller on Kubernetes already handles AccessToken resources.

Choices:

  • false ← (default)

  • true

remote

boolean

Determines if the resources are located at the inventory host instead of the control node.

Choices:

  • false ← (default)

  • true

state

string

present means that if the resource does not exist, it will be created. If it exists, no change is made.

latest means that if the resource does not exist it will be created or updated with the latest provided definition.

absent means that the resource will be removed.

Choices:

  • "present" ← (default)

  • "latest"

  • "absent"

Examples

# Applying resources to a kubernetes cluster
- name: Apply Skupper Resources
  skupper.v2.resource:
    path: /home/user/west/crs
    platform: kubernetes
    namespace: west

# Applying remote resources to a kubernetes cluster
- name: Apply Skupper Resources
  skupper.v2.resource:
    path: /remote/home/user/west/crs
    remote: true
    platform: kubernetes
    namespace: west

# Applying resources to a non-kube namespace
- name: Apply Skupper Resources
  skupper.v2.resource:
    path: /home/user/west/crs
    platform: podman
    namespace: west

# Define a single resource
- name: Define resources for west site
  skupper.v2.resource:
    namespace: west
    def: |
      ---
      apiVersion: skupper.io/v2alpha1
      kind: Site
      metadata:
        name: west
      spec:
        linkAccess: default
      ---
      apiVersion: skupper.io/v2alpha1
      kind: Listener
      metadata:
        name: backend
      spec:
        host: backend
        port: 8080
        routingKey: backend

- name: Redeem access token on a non-kubernetes site (apply Secret/Link only)
  skupper.v2.resource:
    namespace: east
    platform: podman
    def: "{{ access_token_yaml }}"
    redeem: true
  register: out

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

redeem_failures

list / elements=string

List of dicts name, msg for HTTP redemption failures on non-kubernetes. The module does not fail; warnings are issued so a repeat run can stay idempotent (for example unchanged with a warning).

Returned: when one or more AccessToken redemptions failed

list / elements=string

List of YAML strings per redeemed token when redeem=true on a non-kubernetes platform. Each string contains all Secret documents from the redeem response, then all Link documents (each group in server response order).

Returned: when redeem is used on non-kubernetes and AccessToken documents were present

Authors

  • Fernando Giorgetti (@fgiorgetti)