sap.sap_operations.pcs_resources_from_status (1.25.0) — filter

Get pcs cluster resources lists

| "added in version" 1.6.0-galaxy of sap.sap_operations"

Authors: Kirill Satarin (@kksat)

Install collection

Install with ansible-galaxy collection install sap.sap_operations:==1.25.0


Add to requirements.yml

  collections:
    - name: sap.sap_operations
      version: 1.25.0

Description

Get pcs resources list from result of sap.sap_operations.pcs_status_info module

Depending on parameters provided, this filter will return list of pcs resources

Primitive, clone and group resources are supported

Several parameters can be provided to filter pcs resources at once, for instance: List all pcs resources with id that contains 'HANA' sap.sap_operations.pcs_resources(id_contains='HANA', resource_agent_class='ocf')

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get cluster status
  sap.sap_operations.pcs_status_info:
  register: pcs_status_info
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Print pcs_resources_from_status
  ansible.builtin.debug:
    msg:
      - "{{ pcs_status_info | sap.sap_operations.pcs_resources_from_status(active=true) }}"
      - "{{ pcs_status_info | sap.sap_operations.pcs_resources_from_status(blocked=true) }}"
      - "{{ pcs_status_info | sap.sap_operations.pcs_resources_from_status(failed=true) }}"
      - "{{ pcs_status_info | sap.sap_operations.pcs_resources_from_status(managed=true) }}"
      - "{{ pcs_status_info | sap.sap_operations.pcs_resources_from_status(maintenance=true) }}"

Inputs

    
id:
    description:
    - Id of the property.
    - Either one of I(name) or I(id) is required.
    required: false
    type: str

role:
    description:
    - Role of the resource.
    - All resources with this role will be returned.
    required: false
    type: str

value:
    description: Result of pcs_status_info execution
    required: true
    type: dict

active:
    description:
    - Active state of the resource.
    - All resources with this active state will be returned.
    required: false
    type: bool

failed:
    description:
    - Failed state of the resource.
    - All resources with this failed state will be returned.
    required: false
    type: bool

blocked:
    description:
    - Blocked state of the resource.
    - All resources with this blocked state will be returned.
    required: false
    type: bool

managed:
    description:
    - Managed state of the resource.
    - All resources with this managed state will be returned.
    required: false
    type: bool

id_contains:
    description:
    - String that should be contained in pcs resource id.
    - All resources with id that contains this string will be returned.
    required: false
    type: str

maintenance:
    description:
    - Maintenance state of the resource.
    - All resources with this maintenance state will be returned.
    required: false
    type: bool

target_role:
    description:
    - Target role of the resource.
    - All resources with this target role will be returned.
    required: false
    type: str

resource_agent:
    description:
    - Resource agent name.
    - All resources with this resource agent will be returned.
    required: false
    type: str

resource_agent_type:
    description:
    - Resource agent type.
    - All resources with this resource agent type will be returned.
    required: false
    type: str

resource_agent_class:
    description:
    - Resource agent class.
    - All resources with this resource agent class will be returned.
    required: false
    type: str

resource_agent_provider:
    description: Resource agent provider.
    required: false
    type: str

Outputs

data:
  description:
  - List of pcs resources filtered by provided parameters
  - Empty list returned on any failure
  elements: dict
  example:
  - resource:
      active: 'false'
      blocked: 'false'
      failed: 'false'
      failure_ignored: 'false'
      id: dummy-resource
      maintenance: 'false'
      managed: 'true'
      nodes_running_on: '0'
      orphaned: 'false'
      resource_agent: ocf::pacemaker:Dummy
      role: Stopped
  - resource:
      active: 'false'
      blocked: 'false'
      failed: 'false'
      failure_ignored: 'false'
      id: dummy-resource-with-options
      maintenance: 'false'
      managed: 'true'
      nodes_running_on: '0'
      orphaned: 'false'
      resource_agent: ocf::pacemaker:Dummy
      role: Stopped
      target_role: Started
  returned: Success
  type: list