sap.sap_operations.pcs_resources filter – Get pcs cluster resources lists

Note

This filter plugin is part of the sap.sap_operations collection.

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install sap.sap_operations.

To use it in a playbook, specify: sap.sap_operations.pcs_resources.

New in sap.sap_operations 1.6.0-galaxy

Synopsis

  • 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’)

Keyword parameters

This describes keyword parameters of the filter. These are the values key1=value1, key2=value2 and so on in the following example: input | sap.sap_operations.pcs_resources(key1=value1, key2=value2, ...)

Parameter

Comments

id

string

Id of the pcs resource.

All resources with this id will be returned.

id_contains

string

String that should be contained in pcs resource id.

All resources with id that contains this string will be returned.

resource_agent_class

string

Class of resource agent for pcs resource

All resources with resource agent class will be returned.

resource_agent_provider

string

Provider of resource agent for pcs resource.

All resources with resource agent provider will be returned.

resource_agent_type

string

Type of resource agent for pcs resource.

All resources with resource agent type will be returned.

value

dictionary / required

Result of sap.sap_operations.pcs_cib_info or sap.sap_operations.pcs_status execution

Notes

Note

  • This module is experimental

  • Module interface (parameters, output) might change in future releases

  • Module interface (parameters, output) might change in future patches

  • Module might be removed in future releases

  • Module released only on Ansible galaxy and is not yet planned to be released on Ansible Automation Hub

Examples

- name: Get cluster CIB
  sap.sap_operations.pcs_cib_info:
  register: pcs_cib_info

- name: Get cluster status
  sap.sap_operations.pcs_status_info:
  register: pcs_status_info

- 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') }}"

Return Value

Key

Description

data

list / elements=dictionary

List of pcs resources filtered by provided parameters

Returned: Success and when sap.sap_operations.pcs_status_info output is provided

Sample: [{"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"}}]

data2

list / elements=dictionary

List of pcs resources filtered by provided parameters

Returned: Success and when sap.sap_operations.pcs_cib_info output is provided

Sample: [{"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"}}]

Authors

  • Kirill Satarin (@kksat)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.