Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace yes, no, default with true, false, d #60

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .yamllint_defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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.

Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand All @@ -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.
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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: []

Expand All @@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions examples/resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/sbd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
12 changes: 5 additions & 7 deletions tasks/check-and-prepare-role-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
}}"
Expand All @@ -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
30 changes: 15 additions & 15 deletions tasks/cluster-setup-pcs-0.10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,65 +14,65 @@
{% 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 }}
{% endfor %}
{% 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 }}
{% endfor %}
{% 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
10 changes: 5 additions & 5 deletions tasks/cluster-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading