sap.sap_operations.pcs_resources_from_cib (1.25.0) — filter

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

| "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_cib_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 CIB
  sap.sap_operations.pcs_cib_info:
  register: cluster_cib
  • 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_from_cib(resource_agent_provider='pacemaker') }}"
      - "{{ pcs_cib_info | sap.sap_operations.pcs_resources_from_cib(resource_agent_type='Dummy') }}"
      - "{{ pcs_cib_info | sap.sap_operations.pcs_resources_from_cib(resource_agent_class='ocf') }}"

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 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
  - Empty list is returned on any failure
  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
  type: list