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

Note

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

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"

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

Authors

  • Fernando Giorgetti (@fgiorgetti)