sap.sap_operations.pcs_resources (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 cluster resources lists from sap.sap_operations.pcs_cib_info or sap.sap_operations.pcs_status result

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

Output of this filter is different for pcs_cib_info and pcs_status result

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 CIB
  sap.sap_operations.pcs_cib_info:
  register: pcs_cib_info
  • 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
  ansible.builtin.debug:
    msg:
      - "{{ pcs_cib_info | sap.sap_operations.pcs_resources }}"
      - "{{ pcs_cib_info | sap.sap_operations.pcs_resources(id='dummy') }}"
      - "{{ pcs_status_info | sap.sap_operations.pcs_resources }}"
      - "{{ pcs_status_info | sap.sap_operations.pcs_resources(id_contains='dummy') }}"

Inputs

    
id:
    description:
    - Id of the pcs resource.
    - All resources with this id will be returned.
    required: false
    type: str

value:
    description: Result of sap.sap_operations.pcs_cib_info or sap.sap_operations.pcs_status
      execution
    required: true
    type: dict

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

resource_agent_type:
    description:
    - Type of resource agent for pcs resource.
    - All resources with resource agent type will be returned.
    required: false
    type: str

resource_agent_class:
    description:
    - Class of resource agent for pcs resource
    - All resources with resource agent class will be returned.
    required: false
    type: str

resource_agent_provider:
    description:
    - Provider of resource agent for pcs resource.
    - All resources with resource agent provider will be returned.
    required: false
    type: str

Outputs

data:
  description: List of pcs resources filtered by provided parameters
  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 and when sap.sap_operations.pcs_status_info output is provided
  type: list
data2:
  description: List of pcs resources filtered by provided parameters
  elements: dict
  example:
  - primitive:
      class: ocf
      id: dummy-resource
      operations:
      - op:
          id: dummy-resource-migrate_from-interval-0s
          interval: 0s
          name: migrate_from
          timeout: 20s
      - op:
          id: dummy-resource-migrate_to-interval-0s
          interval: 0s
          name: migrate_to
          timeout: 20s
      - op:
          id: dummy-resource-monitor-interval-10s
          interval: 10s
          name: monitor
          timeout: 20s
      - op:
          id: dummy-resource-reload-interval-0s
          interval: 0s
          name: reload
          timeout: 20s
      - op:
          id: dummy-resource-reload-agent-interval-0s
          interval: 0s
          name: reload-agent
          timeout: 20s
      - op:
          id: dummy-resource-start-interval-0s
          interval: 0s
          name: start
          timeout: 20s
      - op:
          id: dummy-resource-stop-interval-0s
          interval: 0s
          name: stop
          timeout: 20s
      provider: pacemaker
      type: Dummy
  - primitive:
      attrib:
        id: dummy-resource-with-options-meta_attributes
      class: ocf
      id: dummy-resource-with-options
      instance_attributes:
      - nvpair:
          id: dummy-resource-with-options-instance_attributes-fake
          name: fake
          value: fake-value
      - nvpair:
          id: dummy-resource-with-options-instance_attributes-passwd
          name: passwd
          value: passwd-value
      meta_attributes:
      - nvpair:
          id: dummy-resource-with-options-meta_attributes-is-managed
          name: is-managed
          value: 'true'
      - nvpair:
          id: dummy-resource-with-options-meta_attributes-target-role
          name: target-role
          value: Started
      operations:
      - op:
          id: dummy-resource-with-options-migrate_from-interval-0s
          interval: 0s
          name: migrate_from
          timeout: 20s
      - op:
          id: dummy-resource-with-options-migrate_to-interval-0s
          interval: 0s
          name: migrate_to
          timeout: 20s
      - op:
          id: dummy-resource-with-options-monitor-interval-1min
          interval: 1min
          name: monitor
          timeout: '5'
      - op:
          id: dummy-resource-with-options-reload-interval-0s
          interval: 0s
          name: reload
          timeout: 20s
      provider: pacemaker
      type: Dummy
  returned: Success and when sap.sap_operations.pcs_cib_info output is provided
  type: list