ansible-collections / community.pacemaker

Collection focusing on modules to deploy and configure Pacemaker clusters.
GNU General Public License v3.0
0 stars 0 forks source link

Modules TODO #5

Open rhysmeister opened 8 months ago

rhysmeister commented 8 months ago

Add pacemaker_resource and pacemaker_sync modules

pacemaker_status - Wait for quroum/votes - like mongodb_status module

rhysmeister commented 8 months ago

pacemaker_resource resource_config is a dict flattened to kv pairs...

- name: Create myFS resource
  pacemaker_resource:
    resource_name: myFS
    resource_type: FileSystem
    resource_config:
      device: 'nfs_server:/export/www'
      directory: '/www'
      fstype: 'nfs'
    resource_group: apache
    state: present

- name: Create floating ip resource
  pacemaker_resource:
    resource_name: ClusterIP
    resource_type: ocf:heartbeat:apache
    resource_config:
      ip: 192.168.122.120
    resource_group: apache
    state: present

- name: Create website
  pacemaker_resource:
    resource_name: website 
    resource_type: ocf:heartbeat:apache
    resource_config:
      configfile: /etc/httpd/conf/httpd.conf 
      statusurl: "http://localhost/server-status"
    resource_group: apache
    state: present

pacemaker_property

The use of stonith-enabled=false is completely inappropriate for a production cluster. It tells the cluster to simply pretend that failed nodes are safely fenced.

- name: Only ever turn fencing off on a test cluster
  pacemaker_property:
    property_name: stonith-enabled
    property_value: false
rhysmeister commented 8 months ago

pacemaker_node

pacemaker_node:
  node: nodea.private.example.com
  state: maintenance|unmaintenance|standby|unstandby|utilization
  utilization:
    cpu: 4
    ram: 1G  # kv pair flatten, only valid when state = utilization

Probably get current info from pcs status nodes cmd.

rhysmeister commented 8 months ago

Modules done...

TODO

rhysmeister commented 7 months ago

pacemaker_constraint

- name: Create a location constraint
  community.pacemaker.pacemaker_constraint:
    name: myResource
    type: location
    prefers:
      node1:
      node2:
      node3: 

- name: Create a location constraint to avoid a node 
  community.pacemaker.pacemaker_constraint:
    name: myResource
    type: location
    avoids:
      node5:

- name: Start resources in a specific order
  community.pacemaker.pacemaker_constraint:
    name: myResource
    type: order
    ordering:
      - start: mounts
      - start: mysql
      - start: https

- name: Stop resources in a specific order
  community.pacemaker.pacemaker_constraint:
    name: myResource
    type: order
    ordering:
      - stop: httpd
      - stop: mysql
      - stop: mounts

- name: Create an ordered set of resources
  community.pacemaker.pacemaker_constraint:
    name: myResource
    type: order
    set:
      - httpd
      - mysql
      - mounts

- name: Colocate resources
  community.pacemaker.pacemaker_constraint:
    name: myResource
    type: colocation
    resources:
      - httpd
      - mysql

- name: Remove a constraint
  community.pacemaker.pacemaker_constraint:
    name: myResource
    state: absent
rhysmeister commented 7 months ago

We need to do a bit of refactoring with the name/id (constraint id). At the moment we create the id from the name and the type...

- name: Create a location constraint
  community.pacemaker.pacemaker_constraint:
    name: myResource
    type: location
    prefers:
     - node1: 100

This task would create an id of "myResource_location". As there are different methods of adding constraints this strategy doesn't really work well. The name in this context is also used as the service to create the constraint on. Therefore we need to do the following...