intellium.rancher.rancher_machine_config (0.0.7) — module

Manage Rancher Machine configs

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

Authors: Wouter Moeken (@intellium), 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 machine configs.

Only tested on vmware vsphere configs!

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# create Machine Config
- name: Test create Machine Config
  intellium.rancher.rancher_machine_config:
    state: present
    host: rancher.example.com
    token: "{{ login['token'] }}"
    name: "vsphere_mc_1"
    type: vsphere
    vsphereconfig:
        cloneFrom: "Ubuntu"
        cpuCount: "4"
        datacenter: "dc-example"
        datastore: "ds-example"
        diskSize: "20480"
        folder: "example"
        memorySize: "4096"
        network: ["VM Network"]
        vcenter: "vcenter.example.com"
    full_response: true
    validate_certs: false

Inputs

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

name:
    description: Name (= rancher id) of the machine config, must be unique
    required: true
    type: str

type:
    choices:
    - vsphere
    - amazonec2
    - azure
    - digitalocean
    - google
    - harvester
    - linode
    description: Type of Machine config. Only vsphere is tested
    required: true
    type: str

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

labels:
    description: Labels to add to nodes created from this machine config
    required: false
    type: dict

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 machine config
    type: str

azureconfig:
    description:
    - azure Machine 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 Machine 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 Machine 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

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

vsphereconfig:
    description:
    - vsphere Machine config to create in Rancher
    - Required when type=vsphere
    required: false
    suboptions:
      boot2dockerUrl:
        default: https://releases.rancher.com/os/latest/rancheros-vmware.iso
        description: clone VM From template or VM
        type: str
      cfgparam:
        default:
        - disk.enableUUID=TRUE
        description: vSphere cfgparam
        elements: str
        type: list
      cloneFrom:
        description: clone VM From template or VM
        required: true
        type: str
      cloudConfig:
        default: '#cloud-config'
        description: cloudConfig
        type: str
      cloudinit:
        default: ''
        description: cloudinit config
        type: str
      contentLibrary:
        default: ''
        description: contentLibrary to clone from
        type: str
      cpuCount:
        description: VM cpuCount
        required: true
        type: str
      creationType:
        choices:
        - template
        - vm
        - library
        - legacy
        default: template
        description: creationType
        type: str
      datacenter:
        description: vSphere datacenter
        required: true
        type: str
      datastore:
        description: vSphere datastore
        required: true
        type: str
      datastoreCluster:
        default: ''
        description: vSphere datastoreCluster
        type: str
      diskSize:
        description: VM diskSize
        required: true
        type: str
      folder:
        description: vSphere VM folder
        required: true
        type: str
      hostsystem:
        default: ''
        description: vSphere host when not using vcenter
        type: str
      memorySize:
        description: vm memorySize
        required: true
        type: str
      network:
        description: vSphere network
        elements: str
        required: true
        type: list
      os:
        default: linux
        description: vm os
        type: str
      tag:
        description: list of vSphere tags
        elements: str
        required: false
        type: list
      vcenter:
        default: ''
        description: vcenter server address
        type: str
      vcenterPort:
        default: '443'
        description: vcenter server port
        type: str
    type: dict

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

amazonec2config:
    description:
    - amazonec2 Machine 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 Machine 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

digitaloceanconfig:
    description:
    - digitalocean Machine 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

Outputs

full_response:
  description: The full API response of the last request
  returned: optional
  type: dict
id:
  description: The ID of the machine config
  returned: always
  type: dict
idcol:
  description: The ID of the machine config separated by colon
  returned: always
  type: dict
output:
  description: The machine config object
  returned: always
  type: dict