ondrejhome.ha_cluster.pcs_cluster (1.0.2) — module

wrapper module for 'pcs cluster setup/destroy/node add/node remove'

| "added in version" 2.4 of ondrejhome.ha_cluster"

Authors: Ondrej Famera (@OndrejHome)

preview | supported by community

Install collection

Install with ansible-galaxy collection install ondrejhome.ha_cluster:==1.0.2


Add to requirements.yml

  collections:
    - name: ondrejhome.ha_cluster
      version: 1.0.2

Description

module for creating/destroying/extending/shrinking clusters using 'pcs' utility

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Setup cluster
  pcs_cluster:
    node_list: "{% for item in play_hosts %}{{ hostvars[item]['ansible_hostname'] }} {% endfor %}"
    cluster_name: 'test-cluster'
  run_once: True
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create cluster with totem token timeout of 5000 ms and UDP unicast transport protocol
  pcs_cluster:
    node_list: "{% for item in play_hosts %}{{ hostvars[item]['ansible_hostname'] }} {% endfor %}"
    cluster_name: 'test-cluster'
    token: 5000
    transport: 'udpu'
  run_once: True
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create cluster with redundant corosync links
  pcs_cluster:
    cluster_name: 'test-cluster'
    node_list: >
      node1.example.com,192.168.1.11
      node2.example.com,192.168.1.12
    state: 'present'
  run_once: True
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create cluster with two redundant corosync links and transport and link options
  pcs_cluster:
    cluster_name: 'test-cluster'
    node_list: >
      node1.example.com,192.168.1.11,192.168.2.11
      node2.example.com,192.168.1.12,192.168.2.12
    transport: 'knet'
    transport_options: link_mode=passive link linknumber=0 transport=udp link_priority=1 link linknumber=1 transport=udp link_priority=2'
  run_once: True
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add new nodes to existing cluster
  pcs_cluster:
    node_list: 'existing-node-1 existing-node-2 new-node-3 new-node-4'
    cluster_name: 'test-cluster'
    allowed_node_changes: 'add'
  run_once: True
  delegate_to: existing-node-1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove nodes from existing cluster cluster (test-cluster= exiting-node-1, exiting-node-2, exiting-node-3, exiting-node-4)
  pcs_cluster:
    node_list: 'existing-node-1 existing-node-2'
    cluster_name: 'test-cluster'
    allowed_node_changes: 'remove'
  run_once: True
  delegate_to: existing-node-1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Destroy cluster on each node
  pcs_cluster:
    state: 'absent'

Inputs

    
state:
    choices:
    - present
    - absent
    default: present
    description:
    - '''present'' - ensure that cluster exists'
    - '''absent'' - ensure cluster doesn''t exist'
    required: false
    type: str

token:
    description:
    - sets time in milliseconds until a token loss is declared after not receiving a token
    required: false
    type: int

node_list:
    description:
    - space separated list of nodes in cluster
    required: false
    type: str

transport:
    choices:
    - default
    - udp
    - udpu
    - knet
    default: default
    description:
    - '''default'' - use default transport protocol (''udp'' in CentOS/RHEL 6, ''udpu''
      in CentOS/RHEL 7), ''knet'' in Fedora 29'
    - '''udp'' - use UDP multicast protocol'
    - '''udpu'' - use UDP unicast protocol'
    - '''knet'' - use KNET protocol'
    required: false
    type: str

cluster_name:
    description:
    - pacemaker cluster name
    required: false
    type: str

transport_options:
    description:
    - additional options for transports (available only with pcs-0.10), this option can
      be used only when `transport` option is specified (non-default)
    required: false
    type: str

allowed_node_changes:
    choices:
    - none
    - add
    - remove
    default: none
    description:
    - '''none'' - node list must match existing cluster if cluster should be present'
    - '''add'' - allow adding new nodes to cluster'
    - '''remove'' - allow removing nodes from cluster'
    required: false
    type: str