phoenixnap.bmc.cluster (1.17.0) — module

Manage phoenixNAP Bare Metal Cloud clusters

| "added in version" 1.1.0 of phoenixnap.bmc"

Authors: Pavle Jojkic (@pajuga) <pavlej@phoenixnap.com>, Goran Jelenic (@goranje) <goranje@phoenixnap.com>

preview | supported by certified

Install collection

Install with ansible-galaxy collection install phoenixnap.bmc:==1.17.0


Add to requirements.yml

  collections:
    - name: phoenixnap.bmc
      version: 1.17.0

Description

Create and manage clusters.

This module has a dependency on requests

API is documented at U(https://developers.phoenixnap.com/docs/rancher/1/overview).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# All the examples assume that you have file config.yaml with your 'clientId' and 'clientSecret'
# in location: ~/.pnap/config.yaml
# and generated SSH key pair in location: ~/.ssh/

- name: Create new cluster for account
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Create cluster
      phoenixnap.bmc.cluster:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        location: PHX
        name: mycluster
        description: mydescritpion
        node_pool_name: mypool
        node_server_type: s1.c1.small
        node_pool_count: 1
        node_install_default_keys: false
        node_key_ids: 6xex7xbx7xex1x4x3xfxex3x, 6yfy6y4yby6ydy2y4ycy2ybyXyX
        state: present
      register: output
    - name: Print the cluster information
      ansible.builtin.debug:
        var: output.clusters
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new clusters | management and workload
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Deployment of both management and workload clusters.
      phoenixnap.bmc.cluster:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        location: PHX
        name: Rancher cluster deployment
        description: mydescritpion
        node_server_type: s1.c1.small
        node_pool_count: 1
        node_install_default_keys: false
        node_key_ids: 6xex7xbx7xex1x4x3xfxex3x, 6yfy6y4yby6ydy2y4ycy2ybyXyX
        workload_configuration:
          name: Workload cluster
          location: PHX
          server_count: 1
          server_type: s2.c2.small
        state: present
      register: output
    - name: Print the cluster information
      ansible.builtin.debug:
        var: output.clusters
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete cluster
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Delete cluster
      phoenixnap.bmc.cluster:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        name: mycluster
      register: output
    - name: Print the cluster information
      ansible.builtin.debug:
        var: output.clusters

Inputs

    
name:
    description: Cluster name.
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description: Desired state of the cluster.
    type: str

token:
    description:
    - Shared secret used to join a server or agent to a cluster.
    - Once a cluster is created, it cannot be modified through a playbook
    type: str

tls_san:
    description:
    - This maps to ranchers tls-san. Add additional hostname or IP as a Subject Alternative
      Name in the TLS cert.
    - Once a cluster is created, it cannot be modified through a playbook
    type: str

location:
    description:
    - Deployment location.
    - Once a cluster is created, it cannot be modified through a playbook
    type: str

client_id:
    description: Client ID (Application Management)
    type: str

node_keys:
    description:
    - List of public SSH keys.
    - Once a cluster is created, it cannot be modified through a playbook
    elements: str
    type: list

node_taint:
    description:
    - This maps to ranchers node-taint. Registering kubelet with set of taints.
    - Once a cluster is created, it cannot be modified through a playbook
    type: str

certificate:
    description:
    - The SSL certificate to be used for rancher admin.
    - Once a cluster is created, it cannot be modified through a playbook
    type: str

description:
    description:
    - Cluster description.
    - Once a cluster is created, it cannot be modified through a playbook
    type: str

node_key_ids:
    description:
    - List of public SSH key identifiers. These are public keys that were already recorded
      on this system.
    - Once a cluster is created, it cannot be modified through a playbook
    elements: str
    type: list

client_secret:
    description: Client Secret (Application Management)
    type: str

ca_certificate:
    description:
    - The SSL CA certificate to be used for rancher admin.
    - Once a cluster is created, it cannot be modified through a playbook
    type: str

cluster_domain:
    description:
    - This maps to ranchers cluster-domain. Cluster Domain.
    - Once a cluster is created, it cannot be modified through a playbook
    type: str

node_pool_name:
    description:
    - The name of the node pool.
    - Once a cluster is created, it cannot be modified through a playbook
    type: str

certificate_key:
    description:
    - The SSL certificate key to be used for rancher admin.
    - Once a cluster is created, it cannot be modified through a playbook
    type: str

node_pool_count:
    description:
    - Number of configured nodes, currently only node counts of 1 and 3 are possible.
    - Once a cluster is created, it cannot be modified through a playbook
    type: int

node_server_type:
    description:
    - Node server type.
    - Once a cluster is created, it cannot be modified through a playbook
    - default is s0.d1.small
    type: str

workload_configuration:
    description: Workload cluster configuration parameters.
    suboptions:
      location:
        description:
        - Workload cluster location. Once a cluster is created, it cannot be modified
          through a playbook.
        type: str
      name:
        description:
        - The name of the workload cluster. This field is autogenerated if not provided.
        - Once a cluster is created, it cannot be modified through a playbook
        type: str
      server_count:
        description:
        - Number of configured servers. Once a cluster is created, it cannot be modified
          through a playbook. Default value is s0.d1.small
        type: int
      server_type:
        description:
        - Node server type. Once a cluster is created, it cannot be modified through a
          playbook. Default value is 1
        type: str
    type: dict

etcd_snapshot_retention:
    description:
    - This maps to ranchers etcd-snapshot-retention. Number of snapshots to retain.
    - Once a cluster is created, it cannot be modified through a playbook
    - Default is 5
    type: int

node_install_default_keys:
    description:
    - Define whether public keys marked as default should be installed on this node.
    - These are public keys that were already recorded on this system.
    - Use GET /ssh-keys to retrieve a list of possible values.
    - Once a cluster is created, it cannot be modified through a playbook
    - deafult is true
    type: bool

etcd_snapshot_schedule_cron:
    description:
    - This maps to ranchers etcd-snapshot-schedule-cron. Snapshot interval time in cron
      spec. eg. every 5 hours
    - Once a cluster is created, it cannot be modified through a playbook
    - Default is '* */12 * * *'
    type: str

Outputs

clusters:
  contains:
    configuration:
      contains:
        certificates:
          contains:
            caCertificate:
              description: The SSL CA certificate to be used for rancher admin.
              type: str
            certificate:
              description: The SSL certificate to be used for rancher admin.
              type: str
            certificateKey:
              description: The SSL certificate key to be used for rancher admin.
              type: str
          description: Define the custom SSL certificates to be used instead of defaults.
          returned: always
          type: complex
        clusterDomain:
          description: This maps to ranchers cluster-domain. Cluster Domain.
          sample: cluster.local
          type: str
        etcdSnapshotScheduleCron:
          description: This maps to ranchers etcd-snapshot-retention. Number of snapshots
            to retain.
          sample: 5
          type: int
        nodeTaint:
          description: This maps to ranchers node-taint. Registering kubelet with
            set of taints.
          sample: CriticalAddonsOnly=true:NoExecute
          type: str
        tlsSan:
          description: This maps to ranchers tls-san. Add additional hostname or IP
            as a Subject Alternative Name in the TLS cert.
          sample: mydomain.com
          type: str
        token:
          description: Shared secret used to join a server or agent to a cluster.
          sample: gS7SnDnY5st0ryJxMXA7
          type: str
      description: Rancher configuration parameters.
      returned: always
      type: list
    description:
      description: My first Rancher Server Cluster.
      returned: always
      sample: Cluster description.
      type: str
    id:
      description: The Cluster identifier.
      returned: always
      sample: 6047127fed34ecc3ba8402d2
      type: str
    initialClusterVersion:
      description: The Rancher version that was installed on the cluster during the
        first creation process.
      returned: always
      sample: v2.5.9
      type: str
    location:
      description: Deployment location.
      returned: always
      sample: PHX
      type: str
    metadata:
      contains:
        password:
          description:
          - This is the password to be used to login to the Rancher Server.
          - This field is returned only as a response to the create cluster request.
          - Make sure to take note or you will not be able to access the server.
          sample: 1234567890abcd!
          type: str
        url:
          description: The Rancher Server URL.
          sample: https://rancher/
          type: str
        username:
          description:
          - The username to use to login to the Rancher Server.
          - This field is returned only as a response to the create cluster request.
          - Make sure to take note or you will not be able to access the server.
          sample: admin
          type: str
      description: Connection parameters to use to connect to the Rancher Server Administrative
        GUI.
      returned: always
      type: complex
    name:
      description: Cluster name. This field is autogenerated if not provided.
      returned: always
      sample: Rancher Management Cluster
      type: str
    nodePools:
      contains:
        name:
          description: The name of the node pool.
          sample: Rancher Server node pool.
          type: str
        nodeCount:
          description: The client ID of the application
          sample: 1
          type: int
        nodes:
          contains:
            serverId:
              description: The server identifier.
              sample: 60b08f04adab617be44068bb
              type: str
          description: The nodes associated with this node pool.
          type: list
        serverType:
          description: Node server type.
          sample: s0.d1.small
          type: str
        sshConfig:
          contains:
            installDefaultKeys:
              description:
              - Define whether public keys marked as default should be installed on
                this node.
              - These are public keys that were already recorded on this system.
              - Use GET /ssh-keys to retrieve a list of possible values.
              sample: true
              type: bool
            keyIds:
              description: List of public SSH key identifiers. These are public keys
                that were already recorded on this system.
              elements: str
              type: list
            keys:
              description: List of public SSH keys.
              elements: str
              type: list
          description:
          - Configuration defining which public SSH keys are pre-installed as authorized
            on the server.
          - Any manual configuration done on the server after installation is not
            reflected by this configuration.
          type: dict
      description: The node pools associated with the cluster.
      returned: always
      type: list
    statusDescription:
      description: The cluster status
      sample: Creating
      type: str
    workloadConfiguration:
      contains:
        location:
          description: Workload cluster location. Cannot be changed once cluster is
            created.
          sample: PHX
          type: str
        name:
          description: The name of the workload cluster. This field is autogenerated
            if not provided.
          sample: Workload CLuster
          type: str
        serverCount:
          description: Number of configured servers. Default value is 1
          sample: 1
          type: int
        server_Type:
          description: Node server type. Cannot be changed once the cluster is created.
            Default value is s0.d1.small
          sample: s0.d1.small
          type: str
      description: Workload cluster configuration parameters.
      type: complex
  description: The clusters information as list
  returned: success
  type: complex