diff --git a/.yamllint_defaults.yml b/.yamllint_defaults.yml index be0b6970..53cfe715 100644 --- a/.yamllint_defaults.yml +++ b/.yamllint_defaults.yml @@ -11,6 +11,6 @@ rules: max-spaces-inside: 1 level: error truthy: - allowed-values: ["yes", "no", "true", "false"] + allowed-values: ["true", "false"] level: error document-start: disable diff --git a/README.md b/README.md index e6fa1d6e..e69e70c4 100644 --- a/README.md +++ b/README.md @@ -26,24 +26,24 @@ An Ansible role for managing High Availability Clustering. #### `ha_cluster_enable_repos` -boolean, default: `yes` +boolean, default: `true` RHEL and CentOS only, enable repositories contaning needed packages #### `ha_cluster_cluster_present` -boolean, default: `yes` +boolean, default: `true` -If set to `yes`, HA cluster will be configured on the hosts according to other -variables. If set to `no`, all HA Cluster configuration will be purged from +If set to `true`, HA cluster will be configured on the hosts according to other +variables. If set to `false`, all HA Cluster configuration will be purged from target hosts. #### `ha_cluster_start_on_boot` -boolean, default: `yes` +boolean, default: `true` -If set to `yes`, cluster services will be configured to start on boot. If set -to `no`, cluster services will be configured not to start on boot. +If set to `true`, cluster services will be configured to start on boot. If set +to `false`, cluster services will be configured not to start on boot. #### `ha_cluster_fence_agent_packages` @@ -139,9 +139,9 @@ certificate - key pair. #### `ha_cluster_regenerate_keys` -boolean, default: `no` +boolean, default: `false` -If this is set to `yes`, pre-shared keys and TLS certificates will be +If this is set to `true`, pre-shared keys and TLS certificates will be regenerated. See also: [`ha_cluster_corosync_key_src`](#ha_cluster_corosync_key_src), @@ -277,7 +277,7 @@ You may take a look at [an example](#advanced-corosync-configuration). #### `ha_cluster_sbd_enabled` -boolean, default: `no` +boolean, default: `false` Defines whether to use SBD. @@ -288,7 +288,7 @@ You may take a look at [an example](#configuring-cluster-to-use-sbd). list, default: `[]` List of name-value dictionaries specifying SBD options. Supported options are: -`delay-start` (defaults to `no`), `startmode` (defaults to `always`), +`delay-start` (defaults to `false`), `startmode` (defaults to `always`), `timeout-action` (defaults to `flush,reboot`) and `watchdog-timeout` (defaults to `5`). See `sbd(8)` man page, section 'Configuration via environment' for their description. @@ -415,7 +415,7 @@ structure, default: no resource clones ```yaml ha_cluster_resource_clones: - resource_id: resource-to-be-cloned - promotable: yes + promotable: true id: custom-clone-id meta_attrs: - attrs: @@ -431,7 +431,7 @@ This variable defines resource clones. The items are as follows: defined in [`ha_cluster_resource_primitives`](#ha_cluster_resource_primitives) or [`ha_cluster_resource_groups`](#ha_cluster_resource_groups). -* `promotable` (optional) - Create a promotable clone, yes or no. +* `promotable` (optional) - Create a promotable clone, `true` or `false`. * `id` (optional) - Custom ID of the clone. If no ID is specified, it will be generated. Warning will be emitted if this option is not supported by the cluster. @@ -971,7 +971,7 @@ They are not guides or best practices for configuring a cluster. vars: ha_cluster_cluster_name: my-new-cluster ha_cluster_hacluster_password: password - ha_cluster_sbd_enabled: yes + ha_cluster_sbd_enabled: true ha_cluster_sbd_options: - name: delay-start value: 'no' @@ -1072,7 +1072,7 @@ They are not guides or best practices for configuring a cluster. ha_cluster_resource_clones: - resource_id: simple-clone - resource_id: clone-with-options - promotable: yes + promotable: true id: custom-clone-id meta_attrs: - attrs: @@ -1081,7 +1081,7 @@ They are not guides or best practices for configuring a cluster. - name: clone-node-max value: '1' - resource_id: cloned-group - promotable: yes + promotable: true ha_cluster_resource_bundles: - id: bundle-with-resource resource-id: bundled-resource @@ -1255,7 +1255,7 @@ They are not guides or best practices for configuring a cluster. ```yaml - hosts: node1 node2 vars: - ha_cluster_cluster_present: no + ha_cluster_cluster_present: false roles: - linux-system-roles.ha_cluster diff --git a/defaults/main.yml b/defaults/main.yml index 538bf033..028b99f8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,10 +1,10 @@ # SPDX-License-Identifier: MIT --- -ha_cluster_enable_repos: yes +ha_cluster_enable_repos: true -ha_cluster_cluster_present: yes +ha_cluster_cluster_present: true -ha_cluster_start_on_boot: yes +ha_cluster_start_on_boot: true ha_cluster_extra_packages: [] @@ -13,7 +13,7 @@ ha_cluster_fence_agent_packages: - fence-virt ha_cluster_hacluster_password: "" -ha_cluster_regenerate_keys: no +ha_cluster_regenerate_keys: false ha_cluster_corosync_key_src: null ha_cluster_pacemaker_key_src: null ha_cluster_fence_virt_key_src: null @@ -26,7 +26,7 @@ ha_cluster_transport: {} ha_cluster_totem: {} ha_cluster_quorum: {} -ha_cluster_sbd_enabled: no +ha_cluster_sbd_enabled: false ha_cluster_sbd_options: [] ha_cluster_pcs_permission_list: diff --git a/examples/resources.yml b/examples/resources.yml index 8ac0b364..c2c0fc23 100644 --- a/examples/resources.yml +++ b/examples/resources.yml @@ -68,7 +68,7 @@ ha_cluster_resource_clones: - resource_id: simple-clone - resource_id: clone-with-options - promotable: yes + promotable: true id: custom-clone-id meta_attrs: - attrs: @@ -77,7 +77,7 @@ - name: clone-node-max value: '1' - resource_id: cloned-group - promotable: yes + promotable: true ha_cluster_resource_bundles: - id: bundle-with-resource resource-id: bundled-resource diff --git a/examples/sbd.yml b/examples/sbd.yml index e54c83d1..0f33923f 100644 --- a/examples/sbd.yml +++ b/examples/sbd.yml @@ -4,7 +4,7 @@ vars: ha_cluster_cluster_name: my-new-cluster ha_cluster_hacluster_password: password - ha_cluster_sbd_enabled: yes + ha_cluster_sbd_enabled: true ha_cluster_sbd_options: - name: delay-start value: 'no' diff --git a/tasks/check-and-prepare-role-variables.yml b/tasks/check-and-prepare-role-variables.yml index 90fa6a24..8e905bf2 100644 --- a/tasks/check-and-prepare-role-variables.yml +++ b/tasks/check-and-prepare-role-variables.yml @@ -8,7 +8,7 @@ when: lookup("vars", item, default="") | length < 1 loop: - ha_cluster_hacluster_password - run_once: yes + run_once: true - name: Fail if nodes do not have the same number of SBD devices specified fail: @@ -20,14 +20,12 @@ | map('extract', hostvars, ['ha_cluster', 'sbd_devices']) | map('default', [], true) | map('length') | unique | length > 1 - run_once: yes + run_once: true when: ha_cluster_cluster_present - name: Discover cluster node names set_fact: - __ha_cluster_node_name: "{{ - ha_cluster.node_name | default(inventory_hostname) - }}" + __ha_cluster_node_name: "{{ ha_cluster.node_name | d(inventory_hostname) }}" - name: Collect cluster node names set_fact: @@ -47,7 +45,7 @@ # - qdevice is not used __ha_cluster_sbd_needs_atb: "{{ ha_cluster_sbd_enabled - and not ha_cluster.sbd_devices | default([]) + and not ha_cluster.sbd_devices | d([]) and __ha_cluster_all_node_names | length is even and not __ha_cluster_qdevice_in_use }}" @@ -57,6 +55,6 @@ msg: Cannot set auto_tie_breaker to disabled when SBD needs it to be enabled when: - __ha_cluster_sbd_needs_atb | bool - - ha_cluster_quorum.options | default([]) + - ha_cluster_quorum.options | d([]) | selectattr('name', 'match', '^auto_tie_breaker$') | map(attribute='value') | select('in', ['0', 0]) | list | length > 0 diff --git a/tasks/cluster-setup-pcs-0.10.yml b/tasks/cluster-setup-pcs-0.10.yml index 078bf7b2..9cdc605f 100644 --- a/tasks/cluster-setup-pcs-0.10.yml +++ b/tasks/cluster-setup-pcs-0.10.yml @@ -14,30 +14,30 @@ {% for node in ansible_play_hosts %} {{ hostvars[node].__ha_cluster_node_name | quote }} {% - for addr in hostvars[node].ha_cluster.corosync_addresses | default([]) + for addr in hostvars[node].ha_cluster.corosync_addresses | d([]) %} addr={{ addr | quote }} {% endfor %} {% endfor %} - {% if ha_cluster_transport | default({}) %} - transport {{ ha_cluster_transport.type | default('knet') | quote }} - {% for option in ha_cluster_transport.options | default([]) %} + {% if ha_cluster_transport | d({}) %} + transport {{ ha_cluster_transport.type | d('knet') | quote }} + {% for option in ha_cluster_transport.options | d([]) %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} - {% for link in ha_cluster_transport.links | default([]) %} + {% for link in ha_cluster_transport.links | d([]) %} link {% for option in link %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} {% endfor %} - {% if ha_cluster_transport.compression | default([]) %} + {% if ha_cluster_transport.compression | d([]) %} compression {% for option in ha_cluster_transport.compression %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} {% endif %} - {% if ha_cluster_transport.crypto | default([]) %} + {% if ha_cluster_transport.crypto | d([]) %} crypto {% for option in ha_cluster_transport.crypto %} {{ option.name | quote }}={{ option.value | quote }} @@ -45,7 +45,7 @@ {% endif %} {% endif %} - {% if ha_cluster_totem.options | default([]) %} + {% if ha_cluster_totem.options | d([]) %} totem {% for option in ha_cluster_totem.options %} {{ option.name | quote }}={{ option.value | quote }} @@ -53,26 +53,26 @@ {% endif %} {% - if __ha_cluster_sbd_needs_atb | default(false) - or ha_cluster_quorum.options | default([]) + if __ha_cluster_sbd_needs_atb | d(false) + or ha_cluster_quorum.options | d([]) %} quorum - {% for option in ha_cluster_quorum.options | default([]) %} + {% for option in ha_cluster_quorum.options | d([]) %} {% if - not __ha_cluster_sbd_needs_atb | default(false) + not __ha_cluster_sbd_needs_atb | d(false) or option.name != 'auto_tie_breaker' %} {{ option.name | quote }}={{ option.value | quote }} {% endif %} {% endfor %} - {% if __ha_cluster_sbd_needs_atb | default(false) %} + {% if __ha_cluster_sbd_needs_atb | d(false) %} auto_tie_breaker=1 {% endif %} {% endif %} - run_once: yes + run_once: true # We always need to create corosync.conf file to see whether it's the same as # what is already present on the cluster nodes. However, we don't want to # report it as a change since the only thing which matters is copying the # resulting corosync.conf to cluster nodes. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/cluster-setup.yml b/tasks/cluster-setup.yml index 6650f0b6..61c4601c 100644 --- a/tasks/cluster-setup.yml +++ b/tasks/cluster-setup.yml @@ -5,12 +5,12 @@ state: file suffix: _ha_cluster_corosync_conf register: __ha_cluster_tempfile_corosync_conf - run_once: yes + run_once: true # We always need to create corosync.conf file to see whether it's the same as # what is already present on the cluster nodes. However, we don't want to # report it as a change since the only thing which matters is copying the # resulting corosync.conf to cluster nodes. - check_mode: no + check_mode: false changed_when: not ansible_check_mode - name: Create a corosync.conf file content @@ -20,7 +20,7 @@ slurp: src: "{{ __ha_cluster_tempfile_corosync_conf.path }}" register: __ha_cluster_data_corosync_conf - run_once: yes + run_once: true when: __ha_cluster_tempfile_corosync_conf.path is defined - name: Distribute corosync.conf file @@ -38,12 +38,12 @@ path: "{{ __ha_cluster_tempfile_corosync_conf.path }}" state: absent when: __ha_cluster_tempfile_corosync_conf.path is defined - run_once: yes + run_once: true # We always need to create corosync.conf file to see whether it's the same as # what is already present on the cluster nodes. However, we don't want to # report it as a change since the only thing which matters is copying the # resulting corosync.conf to cluster nodes. - check_mode: no + check_mode: false changed_when: not ansible_check_mode - name: Get corosync authkey diff --git a/tasks/cluster-start-and-reload.yml b/tasks/cluster-start-and-reload.yml index 2eb5e031..2873c44a 100644 --- a/tasks/cluster-start-and-reload.yml +++ b/tasks/cluster-start-and-reload.yml @@ -34,8 +34,8 @@ __ha_cluster_distribute_corosync_conf.changed or __ha_cluster_distribute_corosync_authkey.changed or __ha_cluster_distribute_pacemaker_authkey.changed - or (__ha_cluster_sbd_service_enable_disable.changed | default(false)) - or (__ha_cluster_distribute_sbd_config.changed | default(false)) + or (__ha_cluster_sbd_service_enable_disable.changed | d(false)) + or (__ha_cluster_distribute_sbd_config.changed | d(false)) - > item != 'corosync-qdevice' or 'corosync-qdevice.service' in ansible_facts.services @@ -55,7 +55,7 @@ - name: Reload corosync configuration command: cmd: corosync-cfgtool -R - run_once: yes + run_once: true when: not ansible_check_mode - name: Start corosync-qdevice @@ -73,13 +73,13 @@ - name: Wait for the cluster to fully start and form membership command: cmd: pcs cluster start --all --wait - run_once: yes + run_once: true # There is no point in waiting in check mode as there is nothing to wait for, # no daemons are actually starting. when: not ansible_check_mode # This is just waiting for cluster to finish starting, no change in # configuration / state occurs as the services were started by tasks above. - changed_when: no + changed_when: false # Purge removed nodes from Pacemaker's caches @@ -96,19 +96,19 @@ # removed from a cluster after corosync / pacemaker restart. Therefore, # crm_node is no help when we want to list such nodes. register: __ha_cluster_list_pacemaker_nodes - run_once: yes + run_once: true # This cannot be run in the check mode as it requires cluster to be started # and its configuration reloaded. Check mode does not start the cluster nor # does it reload its configuration, it only shows the cluster would be # started. when: not ansible_check_mode # This only lists a part of cluster configuration. - changed_when: no + changed_when: false - name: Purge removed nodes from pacemaker's cache command: cmd: pcs -- cluster node clear {{ item | quote }} - run_once: yes + run_once: true loop: "{{ __ha_cluster_list_pacemaker_nodes.stdout_lines }}" # This cannot be run in the check mode as it requires cluster to be started. # Check mode does not start the cluster, it only shows the cluster would be diff --git a/tasks/create-and-push-cib.yml b/tasks/create-and-push-cib.yml index b12bebfb..c349a1e8 100644 --- a/tasks/create-and-push-cib.yml +++ b/tasks/create-and-push-cib.yml @@ -12,7 +12,7 @@ state: file suffix: _ha_cluster_original_cib_xml register: __ha_cluster_tempfile_original_cib_xml - check_mode: no + check_mode: false changed_when: not ansible_check_mode - name: Create a tempfile for new CIB @@ -20,15 +20,15 @@ state: file suffix: _ha_cluster_cib_xml register: __ha_cluster_tempfile_cib_xml - check_mode: no + check_mode: false changed_when: not ansible_check_mode - name: Fetch CIB configuration command: cmd: cibadmin --query register: __ha_cluster_fetch_cib - check_mode: no - changed_when: no # this is a read-only command + check_mode: false + changed_when: false # this is a read-only command - name: Write CIB configuration copy: @@ -40,7 +40,7 @@ loop: - "{{ __ha_cluster_tempfile_cib_xml.path }}" - "{{ __ha_cluster_tempfile_original_cib_xml.path }}" - check_mode: no + check_mode: false changed_when: not ansible_check_mode # Starting with an empty CIB would remove all nodes and other parts of CIB @@ -70,7 +70,7 @@ )]' environment: CIB_file: "{{ __ha_cluster_tempfile_cib_xml.path }}" - check_mode: no + check_mode: false changed_when: not ansible_check_mode @@ -84,7 +84,7 @@ # ha_cluster_cluster_properties vars: properties_set: "{{ ha_cluster_cluster_properties[0] }}" - when: ha_cluster_cluster_properties[0].attrs | default([]) + when: ha_cluster_cluster_properties[0].attrs | d([]) - block: ## Resources @@ -131,7 +131,7 @@ - name: Configure resource colocation constraints include_tasks: pcs-cib-constraint-colocation.yml - when: not constraint.resource_sets | default() + when: not constraint.resource_sets | d() loop: "{{ ha_cluster_constraints_colocation }}" loop_control: index_var: constraint_index @@ -141,7 +141,7 @@ include_tasks: pcs-cib-constraint-set.yml vars: constraint_type: colocation - when: constraint.resource_sets | default() + when: constraint.resource_sets | d() loop: "{{ ha_cluster_constraints_colocation }}" loop_control: index_var: constraint_index @@ -149,7 +149,7 @@ - name: Configure resource order constraints include_tasks: pcs-cib-constraint-order.yml - when: not constraint.resource_sets | default() + when: not constraint.resource_sets | d() loop: "{{ ha_cluster_constraints_order }}" loop_control: index_var: constraint_index @@ -159,7 +159,7 @@ include_tasks: pcs-cib-constraint-set.yml vars: constraint_type: order - when: constraint.resource_sets | default() + when: constraint.resource_sets | d() loop: "{{ ha_cluster_constraints_order }}" loop_control: index_var: constraint_index @@ -167,7 +167,7 @@ - name: Configure resource ticket constraints include_tasks: pcs-cib-constraint-ticket.yml - when: not constraint.resource_sets | default() + when: not constraint.resource_sets | d() loop: "{{ ha_cluster_constraints_ticket }}" loop_control: index_var: constraint_index @@ -177,7 +177,7 @@ include_tasks: pcs-cib-constraint-set.yml vars: constraint_type: ticket - when: constraint.resource_sets | default() + when: constraint.resource_sets | d() loop: "{{ ha_cluster_constraints_ticket }}" loop_control: index_var: constraint_index @@ -201,7 +201,7 @@ state: file suffix: _ha_cluster_cib_diff register: __ha_cluster_tempfile_cib_diff - check_mode: no + check_mode: false changed_when: not ansible_check_mode - name: Compare new and original CIB @@ -211,7 +211,7 @@ --original {{ __ha_cluster_tempfile_original_cib_xml.path }} --new {{ __ha_cluster_tempfile_cib_xml.path }} register: __ha_cluster_cib_diff - check_mode: no + check_mode: false changed_when: not ansible_check_mode failed_when: - __ha_cluster_cib_diff.rc != 0 # success, CIBs are the same @@ -224,7 +224,7 @@ owner: root group: root mode: 0600 - check_mode: no + check_mode: false changed_when: not ansible_check_mode when: __ha_cluster_cib_diff.rc == 1 @@ -233,7 +233,7 @@ cmd: > cibadmin --verbose --patch --xml-file {{ __ha_cluster_tempfile_cib_diff.path | quote }} - run_once: yes + run_once: true when: __ha_cluster_cib_diff.rc == 1 - name: Remove CIB tempfiles @@ -244,5 +244,5 @@ - "{{ __ha_cluster_tempfile_cib_xml }}" - "{{ __ha_cluster_tempfile_original_cib_xml }}" - "{{ __ha_cluster_tempfile_cib_diff }}" - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/enable-repositories/CentOS.yml b/tasks/enable-repositories/CentOS.yml index fe8b04bb..ae115dfb 100644 --- a/tasks/enable-repositories/CentOS.yml +++ b/tasks/enable-repositories/CentOS.yml @@ -4,10 +4,10 @@ command: cmd: dnf repolist # See the comment bellow. - warn: no + warn: false register: __ha_cluster_repolist - changed_when: no - check_mode: no + changed_when: false + check_mode: false - name: Enable CentOS repositories command: @@ -23,6 +23,6 @@ # # Using dnf, similar differences must also be handled. But at least the # approach and __ha_cluster_repos structure is the same as for RHEL. - warn: no + warn: false loop: "{{ __ha_cluster_repos }}" when: item.name not in __ha_cluster_repolist.stdout diff --git a/tasks/enable-repositories/RedHat.yml b/tasks/enable-repositories/RedHat.yml index 6b74b6ac..35ddc43a 100644 --- a/tasks/enable-repositories/RedHat.yml +++ b/tasks/enable-repositories/RedHat.yml @@ -3,10 +3,10 @@ - name: List active RHEL repositories command: cmd: dnf repolist - warn: no + warn: false register: __ha_cluster_repolist - changed_when: no - check_mode: no + changed_when: false + check_mode: false - name: Enable RHEL repositories command: subscription-manager repos --enable {{ item.id | quote }} diff --git a/tasks/pcs-auth-pcs-0.10.yml b/tasks/pcs-auth-pcs-0.10.yml index 06bd6eac..0bc214d3 100644 --- a/tasks/pcs-auth-pcs-0.10.yml +++ b/tasks/pcs-auth-pcs-0.10.yml @@ -8,10 +8,10 @@ pcs host auth -u hacluster -- {% for node in ansible_play_hosts %} {{ hostvars[node].__ha_cluster_node_name | quote }} - {% if hostvars[node].ha_cluster.pcs_address | default("") %} + {% if hostvars[node].ha_cluster.pcs_address | d("") %} addr={{ hostvars[node].ha_cluster.pcs_address | quote }} {% endif %} {% endfor %} stdin: "{{ ha_cluster_hacluster_password }}" - run_once: yes - changed_when: yes + run_once: true + changed_when: true diff --git a/tasks/pcs-auth.yml b/tasks/pcs-auth.yml index b7c1bd62..567a39e4 100644 --- a/tasks/pcs-auth.yml +++ b/tasks/pcs-auth.yml @@ -8,7 +8,7 @@ {{ hostvars[node].__ha_cluster_node_name | quote }} {% endfor %} register: __ha_cluster_pcs_auth_status - check_mode: no + check_mode: false # rc == 0 means all nodes are authenticated # rc == 2 means not all nodes are authenticated # any other rc means an error @@ -20,7 +20,7 @@ - name: Run pcs auth include_tasks: pcs-auth-{{ __ha_cluster_pcs_provider }}.yml # Include the tasks for nodes which can not talk to other nodes due to - # missing pcs auth tokens. The pcs-auth-*.yml contains "run_once: yes" as + # missing pcs auth tokens. The pcs-auth-*.yml contains "run_once: true" as # running the auth on one node is sufficient (auth tokens are distributed by # pcs automatically). By appling "when" here and "run_once" in the included # task, it is achieved that the pcs auth command is run once on one of the diff --git a/tasks/pcs-cib-constraint-colocation.yml b/tasks/pcs-cib-constraint-colocation.yml index 96e523bf..2423471a 100644 --- a/tasks/pcs-cib-constraint-colocation.yml +++ b/tasks/pcs-cib-constraint-colocation.yml @@ -1,49 +1,43 @@ # SPDX-License-Identifier: MIT --- - name: Configure colocation constraint '{{ - constraint.id | default(constraint_index) + constraint.id | d(constraint_index) }}' command: cmd: > pcs -f {{ __ha_cluster_tempfile_cib_xml.path | quote }} -- constraint colocation add - {% if constraint.resource_follower.role | default() %} + {% if constraint.resource_follower.role | d() %} {{ __ha_cluster_pcs_cli_role[constraint.resource_follower.role | lower] - | default(constraint.resource_follower.role) + | d(constraint.resource_follower.role) | lower | quote }} {% endif %} {{ constraint.resource_follower.id | quote }} with - {% if constraint.resource_leader.role | default() %} + {% if constraint.resource_leader.role | d() %} {{ __ha_cluster_pcs_cli_role[constraint.resource_leader.role | lower] - | default(constraint.resource_leader.role) + | d(constraint.resource_leader.role) | lower | quote }} {% endif %} {{ constraint.resource_leader.id | quote }} - {% - for option in constraint.options | default([]) - if option.name == 'score' - %} + {% for option in constraint.options | d([]) if option.name == 'score' %} {{ option.value | quote }} {% else %} INFINITY {% endfor %} - {% if constraint.id | default() %} + {% if constraint.id | d() %} id={{ constraint.id | quote }} {% endif %} - {% - for option in constraint.options | default([]) - if option.name != 'score' - %} + {% for option in constraint.options | d([]) if option.name != 'score' %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} # We always need to create CIB to see whether it's the same as what is # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/pcs-cib-constraint-location.yml b/tasks/pcs-cib-constraint-location.yml index dd0e537c..a12a5f33 100644 --- a/tasks/pcs-cib-constraint-location.yml +++ b/tasks/pcs-cib-constraint-location.yml @@ -1,73 +1,64 @@ # SPDX-License-Identifier: MIT --- - name: Configure location constraint '{{ - constraint.id | default(constraint_index) + constraint.id | d(constraint_index) }}' command: cmd: > pcs -f {{ __ha_cluster_tempfile_cib_xml.path | quote }} -- constraint location - {% if constraint.rule | default() %} - {% if constraint.resource.pattern | default() %} + {% if constraint.rule | d() %} + {% if constraint.resource.pattern | d() %} regexp%{{ constraint.resource.pattern | quote }} {% else %} {{ constraint.resource.id | quote }} {% endif %} rule - {% if constraint.id | default() %} + {% if constraint.id | d() %} constraint-id={{ constraint.id | quote }} {% endif %} - {% if constraint.resource.role | default() %} + {% if constraint.resource.role | d() %} role={{ __ha_cluster_pcs_cli_role[constraint.resource.role | lower] - | default(constraint.resource.role) + | d(constraint.resource.role) | lower | quote }} {% endif %} - {% for option in constraint.options | default([]) %} + {% for option in constraint.options | d([]) %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} {{ constraint.rule }} {% elif - (constraint.id | default()) + (constraint.id | d()) or ( - constraint.options | default([]) + constraint.options | d([]) | rejectattr('name', 'match', '^score$') | list ) %} add {{ constraint.id | quote }} - {% if constraint.resource.pattern | default() %} + {% if constraint.resource.pattern | d() %} regexp%{{ constraint.resource.pattern | quote }} {% else %} {{ constraint.resource.id | quote }} {% endif %} {{ constraint.node | quote }} - {% - for option in constraint.options | default([]) - if option.name == 'score' - %} + {% for option in constraint.options | d([]) if option.name == 'score' %} {{ option.value | quote }} {% else %} INFINITY {% endfor %} - {% - for option in constraint.options | default([]) - if option.name != 'score' - %} + {% for option in constraint.options | d([]) if option.name != 'score' %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} {% else %} - {% if constraint.resource.pattern | default() %} + {% if constraint.resource.pattern | d() %} regexp%{{ constraint.resource.pattern | quote }} {% else %} {{ constraint.resource.id | quote }} {% endif %} prefers - {% - for option in constraint.options | default([]) - if option.name == 'score' - %} + {% for option in constraint.options | d([]) if option.name == 'score' %} {{ constraint.node | quote }}={{ option.value | quote }} {% else %} {{ constraint.node | quote }}=INFINITY @@ -77,5 +68,5 @@ # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/pcs-cib-constraint-order.yml b/tasks/pcs-cib-constraint-order.yml index f8757a6c..9daed66d 100644 --- a/tasks/pcs-cib-constraint-order.yml +++ b/tasks/pcs-cib-constraint-order.yml @@ -1,30 +1,28 @@ # SPDX-License-Identifier: MIT --- -- name: Configure order constraint '{{ - constraint.id | default(constraint_index) - }}' +- name: Configure order constraint '{{ constraint.id | d(constraint_index) }}' command: cmd: > pcs -f {{ __ha_cluster_tempfile_cib_xml.path | quote }} -- constraint order - {% if constraint.resource_first.action | default() %} + {% if constraint.resource_first.action | d() %} {{ constraint.resource_first.action | quote }} {% endif %} {{ constraint.resource_first.id | quote }} then - {% if constraint.resource_then.action | default() %} + {% if constraint.resource_then.action | d() %} {{ constraint.resource_then.action | quote }} {% endif %} {{ constraint.resource_then.id | quote }} - {% if constraint.id | default() %} + {% if constraint.id | d() %} id={{ constraint.id | quote }} {% endif %} - {% for option in constraint.options | default([]) %} + {% for option in constraint.options | d([]) %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} # We always need to create CIB to see whether it's the same as what is # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/pcs-cib-constraint-set.yml b/tasks/pcs-cib-constraint-set.yml index e4d817a3..ecd40716 100644 --- a/tasks/pcs-cib-constraint-set.yml +++ b/tasks/pcs-cib-constraint-set.yml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT --- - name: Configure {{ constraint_type }} constraint '{{ - constraint.id | default(constraint_index) + constraint.id | d(constraint_index) }}' command: cmd: > @@ -12,11 +12,11 @@ {% for resource in set.resource_ids %} {{ resource | quote }} {% endfor %} - {% for option in set.options | default([]) %} + {% for option in set.options | d([]) %} {% if option.name == 'role' %} role={{ __ha_cluster_pcs_cli_role[option.value | lower] - | default(option.value) + | d(option.value) | capitalize | quote }} {% else %} @@ -26,17 +26,17 @@ {% endfor %} {% if constraint_type == 'ticket' - or (constraint.id | default()) - or (constraint.options | default()) + or (constraint.id | d()) + or (constraint.options | d()) %} setoptions {% if constraint_type == 'ticket' %} ticket={{ constraint.ticket | quote }} {% endif %} - {% if constraint.id | default() %} + {% if constraint.id | d() %} id={{ constraint.id | quote }} {% endif %} - {% for option in constraint.options | default([]) %} + {% for option in constraint.options | d([]) %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} {% endif %} @@ -44,5 +44,5 @@ # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/pcs-cib-constraint-ticket.yml b/tasks/pcs-cib-constraint-ticket.yml index 2ff7ac61..ae5fe88b 100644 --- a/tasks/pcs-cib-constraint-ticket.yml +++ b/tasks/pcs-cib-constraint-ticket.yml @@ -1,30 +1,28 @@ # SPDX-License-Identifier: MIT --- -- name: Configure ticket constraint '{{ - constraint.id | default(constraint_index) - }}' +- name: Configure ticket constraint '{{ constraint.id | d(constraint_index) }}' command: cmd: > pcs -f {{ __ha_cluster_tempfile_cib_xml.path | quote }} -- constraint ticket add {{ constraint.ticket | quote }} - {% if constraint.resource.role | default() %} + {% if constraint.resource.role | d() %} {{ __ha_cluster_pcs_cli_role[constraint.resource.role | lower] - | default(constraint.resource.role) + | d(constraint.resource.role) | lower | quote }} {% endif %} {{ constraint.resource.id | quote }} - {% if constraint.id | default() %} + {% if constraint.id | d() %} id={{ constraint.id | quote }} {% endif %} - {% for option in constraint.options | default([]) %} + {% for option in constraint.options | d([]) %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} # We always need to create CIB to see whether it's the same as what is # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/pcs-cib-resource-bundle.yml b/tasks/pcs-cib-resource-bundle.yml index c4b833a4..30bd7660 100644 --- a/tasks/pcs-cib-resource-bundle.yml +++ b/tasks/pcs-cib-resource-bundle.yml @@ -8,32 +8,32 @@ pcs -f {{ __ha_cluster_tempfile_cib_xml.path | quote }} -- resource bundle create {{ resource_bundle.id | quote }} container {{ resource_bundle.container.type | quote }} - {% for option in resource_bundle.container.options | default([]) %} + {% for option in resource_bundle.container.options | d([]) %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} - {% if resource_bundle.network_options | default([]) %} + {% if resource_bundle.network_options | d([]) %} network - {% for option in resource_bundle.network_options | default([]) %} + {% for option in resource_bundle.network_options | d([]) %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} {% endif %} - {% for map in resource_bundle.port_map | default([]) %} + {% for map in resource_bundle.port_map | d([]) %} port-map - {% for option in map | default([]) %} + {% for option in map | d([]) %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} {% endfor %} - {% for map in resource_bundle.storage_map | default([]) %} + {% for map in resource_bundle.storage_map | d([]) %} storage-map - {% for option in map | default([]) %} + {% for option in map | d([]) %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} {% endfor %} - {% if resource_bundle.meta_attrs[0].attrs | default([]) %} + {% if resource_bundle.meta_attrs[0].attrs | d([]) %} meta {% for attr in resource_bundle.meta_attrs[0].attrs %} {{ attr.name | quote }}={{ attr.value | quote }} @@ -43,5 +43,5 @@ # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/pcs-cib-resource-clone.yml b/tasks/pcs-cib-resource-clone.yml index d9b5cc5c..a780523b 100644 --- a/tasks/pcs-cib-resource-clone.yml +++ b/tasks/pcs-cib-resource-clone.yml @@ -5,17 +5,17 @@ msg: > Custom clone id '{{ resource_clone.id }}' is ignored for resource clone '{{ resource_clone.resource_id }}', please upgrade pcs - ignore_errors: yes # noqa ignore-errors + ignore_errors: true # noqa ignore-errors when: - resource_clone.id is defined - not ( ( - resource_clone.promotable | default(false) + resource_clone.promotable | d(false) and 'pcmk.resource.promotable.custom-id' in __ha_cluster_pcs_capabilities ) or ( - not resource_clone.promotable | default(false) + not resource_clone.promotable | d(false) and 'pcmk.resource.clone.custom-id' in __ha_cluster_pcs_capabilities ) @@ -28,7 +28,7 @@ cmd: > pcs -f {{ __ha_cluster_tempfile_cib_xml.path | quote }} -- resource - {% if resource_clone.promotable | default(false) %} + {% if resource_clone.promotable | d(false) %} promotable {% else %} clone @@ -39,12 +39,12 @@ resource_clone.id is defined and ( ( - resource_clone.promotable | default(false) + resource_clone.promotable | d(false) and 'pcmk.resource.promotable.custom-id' in __ha_cluster_pcs_capabilities ) or ( - not resource_clone.promotable | default(false) + not resource_clone.promotable | d(false) and 'pcmk.resource.clone.custom-id' in __ha_cluster_pcs_capabilities ) @@ -52,7 +52,7 @@ %} {{ resource_clone.id | quote }} {% endif %} - {% if resource_clone.meta_attrs[0].attrs | default([]) %} + {% if resource_clone.meta_attrs[0].attrs | d([]) %} {% for attr in resource_clone.meta_attrs[0].attrs %} {{ attr.name | quote }}={{ attr.value | quote }} {% endfor %} @@ -61,5 +61,5 @@ # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/pcs-cib-resource-group.yml b/tasks/pcs-cib-resource-group.yml index ca6f34ea..0c9eaa94 100644 --- a/tasks/pcs-cib-resource-group.yml +++ b/tasks/pcs-cib-resource-group.yml @@ -12,7 +12,7 @@ # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode - name: Configure meta attributes of resource group '{{ resource_group.id }}' @@ -23,10 +23,10 @@ {% for attr in resource_group.meta_attrs[0].attrs %} {{ attr.name | quote }}={{ attr.value | quote }} {% endfor %} - when: resource_group.meta_attrs[0].attrs | default([]) + when: resource_group.meta_attrs[0].attrs | d([]) # We always need to create CIB to see whether it's the same as what is # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/pcs-cib-resource-primitive.yml b/tasks/pcs-cib-resource-primitive.yml index 4d8e237a..8f319bf6 100644 --- a/tasks/pcs-cib-resource-primitive.yml +++ b/tasks/pcs-cib-resource-primitive.yml @@ -15,26 +15,26 @@ {{ resource.agent | quote }} {% endif %} - {% if resource.instance_attrs[0].attrs | default([]) %} + {% if resource.instance_attrs[0].attrs | d([]) %} {% for attr in resource.instance_attrs[0].attrs %} {{ attr.name | quote }}={{ attr.value | quote }} {% endfor %} {% endif %} - {% if resource.meta_attrs[0].attrs | default([]) %} + {% if resource.meta_attrs[0].attrs | d([]) %} meta {% for attr in resource.meta_attrs[0].attrs %} {{ attr.name | quote }}={{ attr.value | quote }} {% endfor %} {% endif %} - {% if resource.operations | default([]) %} + {% if resource.operations | d([]) %} {% for operation in resource.operations %} op {% if operation.action is defined %} {{ operation.action | quote }} {% endif %} - {% if operation.attrs | default([]) %} + {% if operation.attrs | d([]) %} {% for attr in operation.attrs %} {{ attr.name | quote }}={{ attr.value | quote }} {% endfor %} @@ -42,12 +42,12 @@ {% endfor %} {% endif %} - {% if __ha_cluster_primitive_bundle_map[resource.id] | default %} + {% if __ha_cluster_primitive_bundle_map[resource.id] | d() %} bundle {{ __ha_cluster_primitive_bundle_map[resource.id] | quote }} {% endif %} # We always need to create CIB to see whether it's the same as what is # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/pcs-cluster-properties.yml b/tasks/pcs-cluster-properties.yml index e60b9e5e..19fc701d 100644 --- a/tasks/pcs-cluster-properties.yml +++ b/tasks/pcs-cluster-properties.yml @@ -10,5 +10,5 @@ # already present in the cluster. However, we don't want to report it as a # change since the only thing which matters is pushing the resulting CIB to # the cluster. - check_mode: no + check_mode: false changed_when: not ansible_check_mode diff --git a/tasks/pcs-configure-pcs-pcsd.yml b/tasks/pcs-configure-pcs-pcsd.yml index 19cd982b..f980524d 100644 --- a/tasks/pcs-configure-pcs-pcsd.yml +++ b/tasks/pcs-configure-pcs-pcsd.yml @@ -48,19 +48,19 @@ owner: root group: root mode: 0644 - trim_blocks: no + trim_blocks: false - name: Start pcsd with updated config files and configure it to start on boot service: name: pcsd state: started - enabled: yes + enabled: true - name: Fetch pcs capabilities command: cmd: pcs --version --full - check_mode: no - changed_when: no # this is a read-only command + check_mode: false + changed_when: false # this is a read-only command register: __ha_cluster_pcs_version - name: Parse pcs capabilities diff --git a/tasks/presharedkey.yml b/tasks/presharedkey.yml index 75ebe352..cc9ce5a5 100644 --- a/tasks/presharedkey.yml +++ b/tasks/presharedkey.yml @@ -31,7 +31,7 @@ no_log: true when: - preshared_key_src is string and preshared_key_src | length > 1 - run_once: yes + run_once: true delegate_to: localhost - name: Generate random {{ preshared_key_label }} @@ -40,7 +40,7 @@ command: cmd: openssl rand -base64 {{ preshared_key_length | quote }} register: __ha_cluster_openssl_rand - changed_when: no + changed_when: false - name: Fetch generated {{ preshared_key_label }} set_fact: @@ -48,7 +48,7 @@ "{{ __ha_cluster_openssl_rand.stdout }}" when: - not (preshared_key_src is string and preshared_key_src | length > 1) - run_once: yes + run_once: true # Prevent key contents to be printed to the output no_log: true @@ -75,7 +75,7 @@ # Prevent key contents to be printed to the output no_log: true # Following variables set the fact for all nodes - delegate_facts: yes + delegate_facts: true delegate_to: "{{ item }}" with_items: "{{ ansible_play_hosts }}" when: diff --git a/tasks/sbd.yml b/tasks/sbd.yml index 9f2f67e2..69bc706d 100644 --- a/tasks/sbd.yml +++ b/tasks/sbd.yml @@ -5,15 +5,15 @@ - name: Probe SBD devices command: cmd: sbd -d {{ item | quote }} dump - loop: "{{ ha_cluster.sbd_devices | default([]) }}" + loop: "{{ ha_cluster.sbd_devices | d([]) }}" register: __ha_cluster_check_sbd_devices_result - changed_when: no + changed_when: false # return_code == 0 means the disk is initialized already # return_code != 0 means the disk is not initialized yet - failed_when: no + failed_when: false # This command doesn't do any changes and so can safely be executed # even in check_mode. - check_mode: no + check_mode: false - name: Initialize SBD devices command: @@ -21,7 +21,7 @@ cmd: > pcs --force -- stonith sbd device setup device={{ item.item | quote }} - {% for option in ha_cluster_sbd_options | default([]) %} + {% for option in ha_cluster_sbd_options | d([]) %} {% if option.name == 'watchdog-timeout' %} watchdog-timeout={{ option.value | quote }} msgwait-timeout={{ option.value * 2 }} @@ -29,7 +29,7 @@ {% endfor %} # The initialization is done only if a device has not been # initialized already. Therefore this task always makes a change. - changed_when: yes + changed_when: true loop: "{{ __ha_cluster_check_sbd_devices_result.results }}" when: item.rc != 0 # Ideally, the block as a whole should run one node at a time. This does @@ -50,12 +50,10 @@ group: root mode: 0644 vars: - options: "{{ ha_cluster_sbd_options | default([]) }}" + options: "{{ ha_cluster_sbd_options | d([]) }}" node_name: "{{ __ha_cluster_node_name }}" - node_watchdog: "{{ - ha_cluster.sbd_watchdog | default('/dev/watchdog') - }}" - node_devices: "{{ ha_cluster.sbd_devices | default([]) }}" + node_watchdog: "{{ ha_cluster.sbd_watchdog | d('/dev/watchdog') }}" + node_devices: "{{ ha_cluster.sbd_devices | d([]) }}" register: __ha_cluster_distribute_sbd_config when: ha_cluster_sbd_enabled @@ -69,10 +67,10 @@ pcs --force {{ ( - ansible_facts.services['pacemaker.service']['state'] | default() + ansible_facts.services['pacemaker.service']['state'] | d() == 'running' ) | ternary('', '-f /var/lib/pacemaker/cib/cib.xml') }} -- property set stonith-watchdog-timeout={{ ha_cluster_sbd_enabled | ternary('', '0') }} - changed_when: yes + changed_when: true diff --git a/tasks/test_cleanup_sbd.yml b/tasks/test_cleanup_sbd.yml index 39ffa445..010b85b4 100644 --- a/tasks/test_cleanup_sbd.yml +++ b/tasks/test_cleanup_sbd.yml @@ -9,7 +9,7 @@ - name: Unmount SBD devices command: cmd: losetup -d {{ __test_sbd_mount.stdout }} - changed_when: yes + changed_when: true - name: Delete backing files for SBD devices file: diff --git a/tasks/test_setup.yml b/tasks/test_setup.yml index a268f663..9e972525 100644 --- a/tasks/test_setup.yml +++ b/tasks/test_setup.yml @@ -19,6 +19,6 @@ # Test systems may not have repositories available through subscriptions - name: Do not try to enable RHEL repositories set_fact: - ha_cluster_enable_repos: no + ha_cluster_enable_repos: false when: - ansible_distribution == 'RedHat' diff --git a/tasks/test_setup_sbd.yml b/tasks/test_setup_sbd.yml index bf655834..0691333f 100644 --- a/tasks/test_setup_sbd.yml +++ b/tasks/test_setup_sbd.yml @@ -8,7 +8,7 @@ --- - name: Load softdog module for SBD to have at least one watchdog command: modprobe softdog - changed_when: yes + changed_when: true - name: Create backing files for SBD devices tempfile: @@ -19,10 +19,10 @@ - name: Initialize backing files for SBD devices command: cmd: dd if=/dev/zero of={{ __test_sbd_tmpfile.path | quote }} bs=1M count=10 - changed_when: yes + changed_when: true - name: Mount SBD devices command: cmd: losetup --show --find {{ __test_sbd_tmpfile.path | quote }} register: __test_sbd_mount - changed_when: yes + changed_when: true diff --git a/templates/sbd b/templates/sbd index 9eaa15b3..01216158 100644 --- a/templates/sbd +++ b/templates/sbd @@ -15,7 +15,7 @@ # and to monitor. If specifying more than one path, use ";" as # separator. # -{% if node_devices | default([]) %} +{% if node_devices | d([]) %} SBD_DEVICE="{{ node_devices | join(';') }}" {% else %} SBD_DEVICE="" @@ -67,7 +67,7 @@ SBD_DELAY_START="{{ option('delay-start', 'no') }}" # Watchdog device to use. If set to /dev/null, no watchdog device will # be used. # -SBD_WATCHDOG_DEV="{{ node_watchdog | default('/dev/watchdog') }}" +SBD_WATCHDOG_DEV="{{ node_watchdog | d('/dev/watchdog') }}" ## Type: integer ## Default: 5 diff --git a/tests/tasks/assert_cluster_running.yml b/tests/tasks/assert_cluster_running.yml index 5a903ed3..774b2fd1 100644 --- a/tests/tasks/assert_cluster_running.yml +++ b/tests/tasks/assert_cluster_running.yml @@ -4,7 +4,7 @@ command: cmd: pcs status pcsd register: auth_status - changed_when: no + changed_when: false - name: Check pcs auth assert: @@ -15,7 +15,7 @@ command: cmd: pcs status register: cluster_status - changed_when: no + changed_when: false - name: Check cluster is running assert: diff --git a/tests/tasks/assert_corosync_config.yml b/tests/tasks/assert_corosync_config.yml index 1c630b82..539ac4f8 100644 --- a/tests/tasks/assert_corosync_config.yml +++ b/tests/tasks/assert_corosync_config.yml @@ -12,7 +12,7 @@ set -euo pipefail pcs cluster corosync | sed -e '/^nodelist {$/,/^}$/ { /^\s/d } ; /^$/d' register: __test_pcs_corosync_config - changed_when: no + changed_when: false - name: Print real corosync configuration debug: diff --git a/tests/tasks/fetch_versions.yml b/tests/tasks/fetch_versions.yml index ae23e4a8..9cee95e5 100644 --- a/tests/tasks/fetch_versions.yml +++ b/tests/tasks/fetch_versions.yml @@ -4,7 +4,7 @@ command: cmd: pcs --version --full register: __test_pcs_version - changed_when: no + changed_when: false - name: Parse pcs capabilities set_fact: diff --git a/tests/tasks/fixture_psks.yml b/tests/tasks/fixture_psks.yml index 33a1427b..81adc344 100644 --- a/tests/tasks/fixture_psks.yml +++ b/tests/tasks/fixture_psks.yml @@ -24,7 +24,7 @@ -keyout "{{ __test_pcsd_private_key_path }}" -out "{{ __test_pcsd_public_key_path }}" -subj "/CN={{ ansible_host }}" - changed_when: no + changed_when: false - name: Generate corosync key copy: @@ -45,7 +45,7 @@ mode: 0400 delegate_to: localhost - run_once: yes + run_once: true vars: __test_pcsd_private_key_path: "{{ playbook_dir }}/tmp/pcsd.key" __test_pcsd_public_key_path: "{{ playbook_dir }}/tmp/pcsd.crt" diff --git a/tests/tests_cib_constraints_create.yml b/tests/tests_cib_constraints_create.yml index c10ae821..f1cf6eaf 100644 --- a/tests/tests_cib_constraints_create.yml +++ b/tests/tests_cib_constraints_create.yml @@ -403,7 +403,7 @@ --xpath 'substring-after(/cib/@validate-with, "pacemaker-")' /var/lib/pacemaker/cib/cib.xml register: __test_cib_validate_with - changed_when: no + changed_when: false - name: Discover role names set_fact: @@ -422,7 +422,7 @@ command: cmd: pcs constraint location --full register: __test_pcs_location_config - changed_when: no + changed_when: false - name: Print real location constraints configuration debug: @@ -543,7 +543,7 @@ command: cmd: pcs constraint colocation --full register: __test_pcs_colocation_config - changed_when: no + changed_when: false - name: Print real colocation constraints configuration debug: @@ -583,7 +583,7 @@ command: cmd: pcs constraint order --full register: __test_pcs_order_config - changed_when: no + changed_when: false - name: Print real order constraints configuration debug: @@ -615,7 +615,7 @@ command: cmd: pcs constraint ticket --full register: __test_pcs_ticket_config - changed_when: no + changed_when: false - name: Print real ticket constraints configuration debug: diff --git a/tests/tests_cib_properties_empty.yml b/tests/tests_cib_properties_empty.yml index 5d6c74f4..74296b6b 100644 --- a/tests/tests_cib_properties_empty.yml +++ b/tests/tests_cib_properties_empty.yml @@ -23,7 +23,7 @@ command: cmd: pcs property register: __test_pcs_property_config - changed_when: no + changed_when: false - name: Debug cluster properties configuration debug: diff --git a/tests/tests_cib_properties_one_set.yml b/tests/tests_cib_properties_one_set.yml index 08ef8096..ed71c9ac 100644 --- a/tests/tests_cib_properties_one_set.yml +++ b/tests/tests_cib_properties_one_set.yml @@ -26,7 +26,7 @@ command: cmd: pcs property register: __test_pcs_property_config - changed_when: no + changed_when: false - name: Debug cluster properties configuration debug: diff --git a/tests/tests_cib_resources_create.yml b/tests/tests_cib_resources_create.yml index b4db6d9c..b62e41e6 100644 --- a/tests/tests_cib_resources_create.yml +++ b/tests/tests_cib_resources_create.yml @@ -178,7 +178,7 @@ ha_cluster_resource_clones: - resource_id: dummy-clone-no-options - resource_id: dummy-clone-promotable - promotable: yes + promotable: true - resource_id: dummy-clone-id id: custom-clone-id1 - resource_id: dummy-clone-empty-attrs1 @@ -192,7 +192,7 @@ - name: target-role value: Stopped - resource_id: dummy-clone-with-attrs2 - promotable: yes + promotable: true id: custom-clone-id2 meta_attrs: - attrs: @@ -279,7 +279,7 @@ command: cmd: pcs stonith config register: __test_pcs_stonith_config - changed_when: no + changed_when: false - name: Print real stonith configuration debug: @@ -314,7 +314,7 @@ command: cmd: pcs --output-format=json stonith config register: __test_pcs_stonith_config - changed_when: no + changed_when: false - name: Print real stonith configuration debug: @@ -512,7 +512,7 @@ command: cmd: pcs resource config register: __test_pcs_resource_config - changed_when: no + changed_when: false - name: Print real resource configuration debug: @@ -756,7 +756,7 @@ command: cmd: pcs --output-format=json resource config register: __test_pcs_resource_config - changed_when: no + changed_when: false - name: Print real resource configuration debug: diff --git a/tests/tests_cluster_basic_custom_packages.yml b/tests/tests_cluster_basic_custom_packages.yml index f2b66c75..6d91303a 100644 --- a/tests/tests_cluster_basic_custom_packages.yml +++ b/tests/tests_cluster_basic_custom_packages.yml @@ -4,7 +4,7 @@ hosts: all vars_files: vars/main.yml vars: - ha_cluster_cluster_present: no + ha_cluster_cluster_present: false __test_extra_package: pcs-snmp ha_cluster_extra_packages: - "{{ __test_extra_package }}" diff --git a/tests/tests_cluster_basic_disabled.yml b/tests/tests_cluster_basic_disabled.yml index 58e3562a..f3a71ad8 100644 --- a/tests/tests_cluster_basic_disabled.yml +++ b/tests/tests_cluster_basic_disabled.yml @@ -5,7 +5,7 @@ vars_files: vars/main.yml vars: ha_cluster_cluster_name: test-cluster - ha_cluster_start_on_boot: no + ha_cluster_start_on_boot: false tasks: - block: diff --git a/tests/tests_cluster_basic_new_psks.yml b/tests/tests_cluster_basic_new_psks.yml index 30c5c7c0..2adb7b48 100644 --- a/tests/tests_cluster_basic_new_psks.yml +++ b/tests/tests_cluster_basic_new_psks.yml @@ -10,7 +10,7 @@ # generate a new key for fence_xvm as there is no key present # generate a new TLS certificate - key pair for pcsd, even if there already # is one - ha_cluster_regenerate_keys: yes + ha_cluster_regenerate_keys: true ha_cluster_corosync_key_src: "{{ playbook_dir }}/tmp/corosync-authkey" __test_pacemaker_key_content: key content to be replaced __test_pcsd_private_key_path: "{{ playbook_dir }}/tmp/pcsd.key" diff --git a/tests/tests_cluster_destroy.yml b/tests/tests_cluster_destroy.yml index 1b4e19f2..0b2141c3 100644 --- a/tests/tests_cluster_destroy.yml +++ b/tests/tests_cluster_destroy.yml @@ -3,7 +3,7 @@ - name: Deconfigure cluster hosts: all vars: - ha_cluster_cluster_present: no + ha_cluster_cluster_present: false tasks: - block: diff --git a/tests/tests_default.yml b/tests/tests_default.yml index 5dada35b..f0a2f13b 100644 --- a/tests/tests_default.yml +++ b/tests/tests_default.yml @@ -14,7 +14,7 @@ error_list: "{{ ansible_failed_result.results | map(attribute='msg') | list }}" - run_once: yes + run_once: true - name: Check errors assert: diff --git a/tests/tests_sbd_all_options.yml b/tests/tests_sbd_all_options.yml index df4be8d7..de8f4965 100644 --- a/tests/tests_sbd_all_options.yml +++ b/tests/tests_sbd_all_options.yml @@ -5,7 +5,7 @@ vars_files: vars/main.yml vars: ha_cluster_cluster_name: test-cluster - ha_cluster_sbd_enabled: yes + ha_cluster_sbd_enabled: true ha_cluster_sbd_options: - name: delay-start value: 2s diff --git a/tests/tests_sbd_check_devices_count.yml b/tests/tests_sbd_check_devices_count.yml index 542db2cb..57227e9f 100644 --- a/tests/tests_sbd_check_devices_count.yml +++ b/tests/tests_sbd_check_devices_count.yml @@ -4,7 +4,7 @@ hosts: all vars_files: vars/main.yml vars: - ha_cluster_sbd_enabled: yes + ha_cluster_sbd_enabled: true tasks: - block: @@ -37,7 +37,7 @@ ansible_failed_result.msg == 'All nodes must have the same number of SBD devices specified' }}" - run_once: yes + run_once: true when: ansible_play_hosts_all | length > 1 always: diff --git a/tests/tests_sbd_defaults.yml b/tests/tests_sbd_defaults.yml index 6a48f8c6..16ec1759 100644 --- a/tests/tests_sbd_defaults.yml +++ b/tests/tests_sbd_defaults.yml @@ -5,7 +5,7 @@ vars_files: vars/main.yml vars: ha_cluster_cluster_name: test-cluster - ha_cluster_sbd_enabled: yes + ha_cluster_sbd_enabled: true tasks: - block: @@ -55,7 +55,7 @@ command: cmd: pcs quorum config register: __test_quorum_config - changed_when: no + changed_when: false - name: Check auto tie breaker in quorum configuration assert: diff --git a/tests/tests_sbd_defaults_disabled.yml b/tests/tests_sbd_defaults_disabled.yml index 10050e9a..714b57ca 100644 --- a/tests/tests_sbd_defaults_disabled.yml +++ b/tests/tests_sbd_defaults_disabled.yml @@ -5,8 +5,8 @@ vars_files: vars/main.yml vars: ha_cluster_cluster_name: test-cluster - ha_cluster_start_on_boot: no - ha_cluster_sbd_enabled: yes + ha_cluster_start_on_boot: false + ha_cluster_sbd_enabled: true tasks: - block: diff --git a/tests/tests_sbd_needs_atb_while_atb_disabled.yml b/tests/tests_sbd_needs_atb_while_atb_disabled.yml index 4c9c7c37..4f330dbc 100644 --- a/tests/tests_sbd_needs_atb_while_atb_disabled.yml +++ b/tests/tests_sbd_needs_atb_while_atb_disabled.yml @@ -4,7 +4,7 @@ hosts: all vars_files: vars/main.yml vars: - ha_cluster_sbd_enabled: yes + ha_cluster_sbd_enabled: true ha_cluster_quorum: options: - name: auto_tie_breaker @@ -38,7 +38,7 @@ - ansible_failed_result.msg == 'Cannot set auto_tie_breaker to disabled when SBD needs it ' ~ 'to be enabled' - run_once: yes + run_once: true when: ansible_play_hosts_all | length is even always: diff --git a/tests/tests_sbd_needs_atb_while_atb_enabled.yml b/tests/tests_sbd_needs_atb_while_atb_enabled.yml index da131aa4..358b327d 100644 --- a/tests/tests_sbd_needs_atb_while_atb_enabled.yml +++ b/tests/tests_sbd_needs_atb_while_atb_enabled.yml @@ -4,7 +4,7 @@ hosts: all vars_files: vars/main.yml vars: - ha_cluster_sbd_enabled: yes + ha_cluster_sbd_enabled: true ha_cluster_quorum: options: - name: auto_tie_breaker @@ -35,7 +35,7 @@ command: cmd: pcs quorum config register: __test_quorum_config - changed_when: no + changed_when: false - name: Check auto tie breaker in quorum configuration assert: diff --git a/vars/main.yml b/vars/main.yml index 0a4a2ab6..f7197dba 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -29,7 +29,7 @@ __ha_cluster_services: - pacemaker # TODO: implement qdevice detection once qdevice is supported by the role -__ha_cluster_qdevice_in_use: no +__ha_cluster_qdevice_in_use: false # ansible_facts required by the role __ha_cluster_required_facts: