ondrejhome / ondrejhome.ha_cluster / 1.0.2 / module / pcs_resource wrapper module for 'pcs resource' | "added in version" 2.4 of ondrejhome.ha_cluster" Authors: Ondrej Famera (@OndrejHome) preview | supported by communityondrejhome.ha_cluster.pcs_resource (1.0.2) — module
Install with ansible-galaxy collection install ondrejhome.ha_cluster:==1.0.2
collections: - name: ondrejhome.ha_cluster version: 1.0.2
Module for creating, deleting and updating clusters resources using 'pcs' utility.
This module should be executed for same resorce only on one of the nodes in cluster at a time.
- name: ensure Dummy('ocf:pacemaker:Dummy') resource with name 'test' is present pcs_resource: name: 'test' resource_type: 'ocf:pacemaker:Dummy'
- name: create 'stonith' class resource 'kdump' of type 'fence_kdump' pcs_resource: name: 'kdump' resource_type: 'fence_kdump' resource_class: 'stonith'
- name: ensure that resource with name 'vip' is not present pcs_resource: name: 'vip' state: 'absent'
- name: ensure resource 'test2' of IPaddr2('ocf:heartbeat:IPaddr2') type exists an has 5 second monitor interval pcs_resource: name: 'test2' resource_type: 'ocf:heartbeat:IPaddr2' options: 'ip=192.168.1.2 op monitor interval=5'
- name: create resource in group 'testgrp' pcs_resource: name: 'test3' resource_type: 'ocf:pacemaker:Dummy' options: '--group testgrp'
- name: create multistate (Master/Slave) resource 'test' of 'ocf:pacemaker:Stateful' type - pcs-0.9 pcs_resource: name: 'test' resource_type: 'ocf:pacemaker:Stateful' resource_class: 'master' options: > fake=some_value --master meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true op monitor interval=60s meta resource-stickiness=100
- name: create multistate (Promotable) resource 'test' of 'ocf:pacemaker:Stateful' type - pcs-0.10 pcs_resource: name: 'test' resource_type: 'ocf:pacemaker:Stateful' resource_class: 'promotable' options: > fake=some_value promotable meta promotable-max=1 promotable-node-max=1 clone-max=2 clone-node-max=1 notify=true op monitor interval=60s meta resource-stickiness=100
- name: ensure Dummy('ocf:pacemaker:Dummy') resource with name 'test' is present, but ignore if it is enabled or disabled (ignore target-role) pcs_resource: name: 'test' resource_type: 'ocf:pacemaker:Dummy' ignored_meta_attributes: [ 'target-role' ]
name: description: - name of cluster resource - cluster resource identifier required: true type: str state: choices: - present - absent default: present description: - '''present'' - ensure that cluster resource exists' - '''absent'' - ensure cluster resource doesn''t exist' required: false type: str options: description: - additional options passed to 'pcs' command required: false type: str cib_file: description: - Apply changes to specified file containing cluster CIB instead of running cluster. - This module requires the file to already contain cluster configuration. required: false type: str child_name: description: - define custom name of child resource when creating multistate resource ('master' or 'promotable' resource_class). - If not specified then the child resource name will have for of name+'-child'. required: false type: str resource_type: description: - cluster resource type required: false type: str resource_class: choices: - ocf - systemd - stonith - master - promotable default: ocf description: - class of cluster resource required: false type: str force_resource_update: description: - When set to 'yes' the pcs will use 'scope=resource' instead of 'scope=all' when creating resources - For primitive resources the default is 'no' while for multistate resources ('master'/'promotable') the default value is 'yes'. - This option is useful in busy clusters where a lot of changes may happen while module is running resulting in error like 'Unable to push to the CIB because pushed configuration is older than existing one.' in which case this is worth a try to see if that resolves the error. However enabling this options may discard other resource config changes made to cluster while module is running. required: false type: bool ignored_meta_attributes: default: [] description: - list of meta attributes that will be ignored when comparing existing resources elements: str required: false type: list