intellium.rancher.rancher_cluster (0.0.7) — module

Manage Rancher Clusters

| "added in version" 0.1.0 of intellium.rancher"

Authors: Cees Moerkerken (@ceesios)

Install collection

Install with ansible-galaxy collection install intellium.rancher:==0.0.7


Add to requirements.yml

  collections:
    - name: intellium.rancher
      version: 0.0.7

Description

This module allows you to manage the lifecycle of Clusters.

Only tested on vmware vsphere clusters!

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add repository
- name: Test create cluster
  intellium.rancher.rancher_cluster:
    state: present
    host: rancher.example.com
    token: "{{ login['token'] }}"
    name: "vsphere_cl01"
    type: vsphere
    vsphereconfig:
        datacenter: "dc-example"
        vcenter: "vcenter.example.com"
        username: "myuser"
        password: "mysecretpass"
    machineGlobalConfig:
        disable:
        - "rke2-ingress-nginx"
    machinePools:
      - displayName: "masters"
        machineConfigRef:
            name: "cl01-master"
        name: "masters"
        workerRole: False
        quantity: 3
      - displayName: "workers"
        machineConfigRef:
            name: "cl01-worker"
        name: "workers"
        controlPlaneRole: False
        quantity: 8
    full_response: true
    validate_certs: false

Inputs

    
cni:
    default: calico
    description: cni
    type: str

host:
    aliases:
    - rancher_host
    description: Hostname of rancher system
    required: true
    type: str

name:
    description: Name of the cluster
    required: true
    type: str

type:
    choices:
    - vsphere
    - amazonec2
    - azure
    - digitalocean
    - google
    - harvester
    - linode
    default: vsphere
    description: Type of Cluster
    type: str

wait:
    default: 0
    description:
    - Wait for max number of seconds until the cluster status is ready
    - Will check the status every 5 seconds
    type: int

state:
    choices:
    - present
    - absent
    default: present
    description: absent or present
    type: str

token:
    aliases:
    - rancher_token
    description: Token used for authentication
    required: false
    type: str

password:
    aliases:
    - rancher_password
    description: Password for user/pass login instead of token
    required: false
    type: str

username:
    aliases:
    - rancher_username
    description: Username for user/pass login instead of token
    required: false
    type: str

namespace:
    default: fleet-default
    description: Namespace of the cluster
    type: str

azureconfig:
    description:
    - azure Cluster config to create in Rancher
    - Required when type=azure
    - for valid subopions check schema at
    - v1/schemas/rke-machine-config.cattle.io.azureconfig
    required: false
    type: dict

googleconfig:
    description:
    - google Cluster config to create in Rancher
    - Required when type=google
    - for valid subopions check schema at
    - v1/schemas/rke-machine-config.cattle.io.googleconfig
    required: false
    type: dict

linodeconfig:
    description:
    - linode Cluster config to create in Rancher
    - Required when type=linode
    - for valid subopions check schema at
    - v1/schemas/rke-machine-config.cattle.io.linodeconfig
    required: false
    type: dict

machinePools:
    description: machinePools
    elements: dict
    required: false
    suboptions:
      controlPlaneRole:
        description:
        - controlPlaneRole (True / False)
        - define false only to change existing clusters
        - will cause changed notifications due to Rancher API
        type: bool
      displayName:
        description: displayName
        type: str
      etcdRole:
        description:
        - etcdRole (True / False)
        - define false only to change existing clusters
        - will cause changed notifications due to Rancher API
        type: bool
      machineConfigRef:
        description: machineConfigRef
        required: false
        suboptions:
          kind:
            default: VmwarevsphereConfig
            description: machineConfigRef kind
            type: str
          name:
            description: machineConfigRef name
            type: str
        type: dict
      name:
        description: name
        type: str
      quantity:
        default: 3
        description: quantity
        type: int
      workerRole:
        description:
        - workerRole (True / False)
        - define false only to change existing clusters
        - will cause changed notifications due to Rancher API
        type: bool
    type: list

full_response:
    description: Whether to return full api response
    required: false
    type: bool

vsphereconfig:
    description:
    - Vsphere config to create in Rancher
    suboptions:
      csi_datastoreurl:
        description:
        - vSphere csi_datastoreurl
        type: str
      datacenter:
        description: vSphere datacenter
        type: str
      host:
        default: ''
        description: vcenter server address
        type: str
      password:
        description:
        - vSphere Password
        - Required when type=vsphere
        type: str
      username:
        description:
        - vSphere username
        - Required when type=vsphere
        type: str
    type: dict

validate_certs:
    default: true
    description: Verify SSL certificates
    required: false
    type: bool

amazonec2config:
    description:
    - amazonec2 Cluster config to create in Rancher
    - Required when type=amazonec2
    - for valid subopions check schema at
    - v1/schemas/rke-machine-config.cattle.io.amazonec2config
    required: false
    type: dict

harvesterconfig:
    description:
    - harvester Cluster config to create in Rancher
    - Required when type=harvester
    - for valid subopions check schema at
    - v1/schemas/rke-machine-config.cattle.io.harvesterconfig
    required: false
    type: dict

upgradeStrategy:
    description: upgradeStrategy
    required: false
    suboptions:
      controlPlaneConcurrency:
        default: 10%
        description: controlPlaneConcurrency
        type: str
      workerConcurrency:
        default: 10%
        description: workerConcurrency
        type: str
    type: dict

cloud_credential:
    description: cni
    required: true
    type: str

digitaloceanconfig:
    description:
    - digitalocean Cluster config to create in Rancher
    - Required when type=digitalocean
    - for valid subopions check schema at
    - v1/schemas/rke-machine-config.cattle.io.digitaloceanconfig
    required: false
    type: dict

kubernetes_version:
    default: v1.24.4+rke2r1
    description: kubernetes version
    type: str

machineGlobalConfig:
    description: machineGlobalConfig
    required: false
    suboptions:
      disable:
        description: disable
        elements: str
        required: false
        type: list
    type: dict

Outputs

full_response:
  description: The full API response of the last request
  returned: optional
  type: dict
id:
  description: The ID of the cluster
  returned: always
  type: dict
idcol:
  description: The ID of the cluster separated by colon
  returned: always
  type: dict
output:
  description: The cluster object
  returned: always
  type: dict
ready:
  description: status of cluster
  returned: always
  type: bool
status:
  description: Description of status
  returned: always
  type: str