stonith_exists

Role Documentation

Welcome to the “stonith_exists” role documentation.

Role Variables: main.yml

metadata:
  name: Validate stonith devices
  description: >
    Verify that stonith devices are configured for your OpenStack Platform HA cluster.
    We don't configure stonith device with TripleO Installer. Because the hardware
    configuration may be differ in each environment and requires different fence agents.
    How to configure fencing please read
    https://access.redhat.com/documentation/en/red-hat-openstack-platform/8/paged/director-installation-and-usage/86-fencing-the-controller-nodes
  groups:
  - post-deployment
  - post-update
  - pre-update

Molecule Scenarios

Molecule is being used to test the “stonith_exists” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.

Scenario: default

Driver: podman:
Molecule Platform(s)
- name: centos
  hostname: centos
  image: centos/centos:stream8
  registry:
    url: quay.io
  dockerfile: ../../../../.config/molecule/Dockerfile
  pkg_extras: python*-setuptools python*-pyyaml
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
  privileged: true
  environment:
    http_proxy: "{{ lookup('env', 'http_proxy') }}"
    https_proxy: "{{ lookup('env', 'https_proxy') }}"
  ulimits:
  - host
Molecule Inventory
hosts:
  all:
    hosts:
      centos:
        ansible_python_interpreter: /usr/bin/python3
Example default playbook
- name: Converge
  hosts: all

  tasks:
  - name: Safe run
    include_role:
      name: stonith_exists

  - name: Fail the validation
    block:
    - name: Faulty pcs script
      copy:
        dest: /usr/bin/pcs
        mode: 0755
        content: |
          #!/bin/sh
          echo "NO stonith devices configured"
          exit 0

    - name: Run validation
      include_role:
        name: stonith_exists

    rescue:
    - name: Clear host errors
      meta: clear_host_errors

    - name: Test output
      debug:
        msg: The validation works! End play

    - name: End play
      meta: end_play

  - name: Fail playbook if reached
    fail:
      msg: |
        The stonith_exists validation didn't properly detect failed
        stonith config