Search code examples
salt-projectpacemaker

saltstack/pacemaker: pcs module fails to create operations options


I am trying to create a pacemaker resource following salt.states.pcs which works fine, until i try to set e.g. the monitor interval and timeout values (or any other op values). E.g.: pcs resource create VirtualIP ocf:heartbeat:IPaddr2 cidr_netmask=24 ip=192.168.16.20 op monitor interval=30s start interval=0s timeout=20s stop interval=0s timeout=20s works without any problem. When I then try to put this in a salt state like

pcs_resource_VirtualIP:
  pcs.resource_present:
    - resource_id: VirtualIP
    - resource_type: ocf:heartbeat:IPaddr2
    - resource_options:
        - cidr_netmask=24
        - ip=192.168.16.20
        - op monitor interval=30s
    - cibname: cib_for_VirtualIP

it always fails with

2022-10-13 13:33:47,167 [salt.loaded.int.module.cmdmod:881 ][ERROR   ][26701] stderr: Error: invalid resource option 'op monitor interval', allowed options are: 'arp_bg', 'arp_count', 'arp_count_refresh', 'arp_interval', 'arp_sender', 'broadcast', 'cidr_netmask', 'clusterip_hash', 'flush_routes', 'iflabel', 'ip', 'lvs_ipv6_addrlabel', 'lvs_ipv6_addrlabel_value', 'lvs_support', 'mac', 'network_namespace', 'nic', 'noprefixroute', 'preferred_lft', 'run_arping', 'send_arp_opts', 'trace_file', 'trace_ra', 'unique_clone_address', use --force to override
Error: Errors have occurred, therefore pcs is unable to continue

I already tried to start with just resource_option only op but then it fails with

2022-10-13 13:35:51,422 [salt.loaded.int.module.cmdmod:881 ][ERROR   ][26971] stderr: Error: When using 'op' you must specify an operation name and at least one option

In the documentation i couldn't find how to add the op values for a resource.

Versions i am using:

salt-master 3004.2
salt-minion 3004.2
pcs 0.10.12

Solution

  • Probably every argument needs to be passed separately:

    pcs_resource_VirtualIP:
      pcs.resource_present:
        - resource_id: VirtualIP
        - resource_type: ocf:heartbeat:IPaddr2
        - resource_options:
            - cidr_netmask=24
            - ip=192.168.16.20
            - op
            - monitor
            - interval=30s
        - cibname: cib_for_VirtualIP
    

    There's also the pcs.resource_op_defaults_to state function, which may be of use.