Skip to content

Commit 8029140

Browse files
tomjelinekrichm
authored andcommitted
refactor: remove unused pcs_provider variable
1 parent 953e687 commit 8029140

13 files changed

+155
-169
lines changed

tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
- not ha_cluster_cluster_present
124124
block:
125125
- name: Remove cluster configuration
126-
include_tasks: shell_{{ ha_cluster_pacemaker_shell }}/cluster-destroy-{{ __ha_cluster_pcs_provider }}.yml # yamllint disable-line rule:line-length
126+
include_tasks: shell_{{ ha_cluster_pacemaker_shell }}/cluster-destroy.yml
127127

128128
- name: Remove fence-virt authkey
129129
file:

tasks/shell_pcs/cluster-auth-pcs-0.10.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

tasks/shell_pcs/cluster-auth.yml

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,47 @@
2121
- __ha_cluster_pcs_auth_status.rc != 2
2222

2323
- name: Run pcs auth
24-
include_tasks: cluster-auth-{{ __ha_cluster_pcs_provider }}.yml
25-
# Include the tasks for nodes which can not talk to other nodes due to
26-
# missing pcs auth tokens. The pcs-auth-*.yml contains "run_once: true" as
27-
# running the auth on one node is sufficient (auth tokens are distributed by
28-
# pcs automatically). By applying "when" here and "run_once" in the included
29-
# task, it is achieved that the pcs auth command is run once on one of the
30-
# nodes which lack pcs auth tokens.
24+
# Running the tasks for nodes which can not talk to other nodes due to
25+
# missing pcs auth tokens. The task contain "run_once: true" as running the
26+
# auth on one node is sufficient (auth tokens are distributed by pcs
27+
# automatically). By applying "when" here and "run_once" in the tasks, it is
28+
# achieved that the pcs auth command is run once on one of the nodes which
29+
# lack pcs auth tokens.
3130
when: not ansible_check_mode and __ha_cluster_pcs_auth_status.rc == 2
31+
block:
32+
- name: Pcs auth
33+
command:
34+
# Always auth all nodes to prevent possible corner cases with
35+
# synchronizing pcs auth tokens in the cluster when not all nodes are
36+
# auth-ed.
37+
cmd: >
38+
pcs host auth -u hacluster --
39+
{% for node in ansible_play_hosts %}
40+
{{ hostvars[node].__ha_cluster_node_name | quote }}
41+
{% if hostvars[node].__ha_cluster_local_node.pcs_address | d("") %}
42+
addr={{ hostvars[node].__ha_cluster_local_node.pcs_address | quote }}
43+
{% endif %}
44+
{% endfor %}
45+
stdin: "{{ ha_cluster_hacluster_password }}"
46+
run_once: true # noqa: run_once[task]
47+
changed_when: true
48+
49+
- name: Pcs auth for qdevice
50+
command:
51+
# Always auth all nodes to prevent possible corner cases with
52+
# synchronizing pcs auth tokens in the cluster when not all nodes are
53+
# auth-ed.
54+
cmd: >
55+
pcs host auth -u hacluster --
56+
{{ __ha_cluster_qdevice_host | quote }}
57+
{% if __ha_cluster_qdevice_pcs_address %}
58+
addr={{ __ha_cluster_qdevice_pcs_address | quote }}
59+
{% endif %}
60+
stdin: "{{ ha_cluster_hacluster_qdevice_password |
61+
d(ha_cluster_hacluster_password) }}"
62+
when:
63+
- __ha_cluster_qdevice_model == "net"
64+
- __ha_cluster_qdevice_host | length > 0
65+
- __ha_cluster_qdevice_host not in __ha_cluster_all_node_names
66+
run_once: true # noqa: run_once[task]
67+
changed_when: true

tasks/shell_pcs/cluster-destroy-pcs-0.10.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

tasks/shell_pcs/cluster-setup-corosync.yml

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,114 @@
1414
changed_when: not ansible_check_mode
1515

1616
- name: Create a corosync.conf file content
17-
include_tasks: pcs-cluster-setup-{{ __ha_cluster_pcs_provider }}.yml
17+
command:
18+
cmd: >
19+
pcs cluster setup
20+
--corosync_conf {{ __ha_cluster_tempfile_corosync_conf.path | quote }}
21+
--overwrite
22+
{% if "cluster.config.uuid" in __ha_cluster_pcs_capabilities %}
23+
--no-cluster-uuid
24+
{% endif %}
25+
--
26+
{{ ha_cluster_cluster_name | quote }}
27+
{% for node in ansible_play_hosts %}
28+
{{ hostvars[node].__ha_cluster_node_name | quote }}
29+
{%
30+
for addr in
31+
hostvars[node].__ha_cluster_local_node.corosync_addresses | d([])
32+
%}
33+
addr={{ addr | quote }}
34+
{% endfor %}
35+
{% endfor %}
36+
37+
{% if ha_cluster_transport | d({}) %}
38+
transport {{ ha_cluster_transport.type | d('knet') | quote }}
39+
{% for option in ha_cluster_transport.options | d([]) %}
40+
{{ option.name | quote }}={{ option.value | quote }}
41+
{% endfor %}
42+
{% for link in ha_cluster_transport.links | d([]) %}
43+
link
44+
{% for option in link %}
45+
{{ option.name | quote }}={{ option.value | quote }}
46+
{% endfor %}
47+
{% endfor %}
48+
{% if ha_cluster_transport.compression | d([]) %}
49+
compression
50+
{% for option in ha_cluster_transport.compression %}
51+
{{ option.name | quote }}={{ option.value | quote }}
52+
{% endfor %}
53+
{% endif %}
54+
{% if ha_cluster_transport.crypto | d([]) %}
55+
crypto
56+
{% for option in ha_cluster_transport.crypto %}
57+
{{ option.name | quote }}={{ option.value | quote }}
58+
{% endfor %}
59+
{% endif %}
60+
{% endif %}
61+
62+
{% if ha_cluster_totem.options | d([]) %}
63+
totem
64+
{% for option in ha_cluster_totem.options %}
65+
{{ option.name | quote }}={{ option.value | quote }}
66+
{% endfor %}
67+
{% endif %}
68+
69+
{%
70+
if __ha_cluster_sbd_needs_atb | d(false)
71+
or ha_cluster_quorum.options | d([])
72+
%}
73+
quorum
74+
{% for option in ha_cluster_quorum.options | d([]) %}
75+
{% if
76+
not __ha_cluster_sbd_needs_atb | d(false)
77+
or option.name != 'auto_tie_breaker'
78+
%}
79+
{{ option.name | quote }}={{ option.value | quote }}
80+
{% endif %}
81+
{% endfor %}
82+
{% if __ha_cluster_sbd_needs_atb | d(false) %}
83+
auto_tie_breaker=1
84+
{% endif %}
85+
{% endif %}
86+
run_once: true # noqa: run_once[task]
87+
# We always need to create corosync.conf file to see whether it's the same as
88+
# what is already present on the cluster nodes. However, we don't want to
89+
# report it as a change since the only thing which matters is copying the
90+
# resulting corosync.conf to cluster nodes.
91+
check_mode: false
92+
changed_when: not ansible_check_mode
93+
94+
- name: Add qdevice configuration to corosync.conf
95+
command:
96+
cmd: >
97+
pcs quorum device add
98+
--corosync_conf {{ __ha_cluster_tempfile_corosync_conf.path | quote }}
99+
--
100+
{% for option in ha_cluster_quorum.device.generic_options | d([]) %}
101+
{{ option.name | quote }}={{ option.value | quote }}
102+
{% endfor %}
103+
model
104+
{{ ha_cluster_quorum.device.model | d() | quote }}
105+
{% for option in ha_cluster_quorum.device.model_options | d([]) %}
106+
{% if option.name != 'pcs-address' %}
107+
{{ option.name | quote }}={{ option.value | quote }}
108+
{% endif %}
109+
{% endfor %}
110+
{% if ha_cluster_quorum.device.heuristics_options | d([]) %}
111+
heuristics
112+
{% for option in ha_cluster_quorum.device.heuristics_options %}
113+
{{ option.name | quote }}={{ option.value | quote }}
114+
{% endfor %}
115+
{% endif %}
116+
run_once: true # noqa: run_once[task]
117+
when:
118+
- __ha_cluster_qdevice_in_use
119+
# We always need to create corosync.conf file to see whether it's the same as
120+
# what is already present on the cluster nodes. However, we don't want to
121+
# report it as a change since the only thing which matters is copying the
122+
# resulting corosync.conf to cluster nodes.
123+
check_mode: false
124+
changed_when: not ansible_check_mode
18125

19126
- name: Fetch created corosync.conf file
20127
slurp:

tasks/shell_pcs/pcs-cib-resource-bundle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
---
33
- name: Configure resource bundle {{ resource_bundle.id }}
44
command:
5-
# pcs-0.10 supports only one set of attributes, that's the reason for
5+
# pcs supports only one set of attributes, that's the reason for
66
# *_attrs[0] instead of looping over *_attrs
77
cmd: >
88
pcs -f {{ __ha_cluster_tempfile_cib_xml.path | quote }}

tasks/shell_pcs/pcs-cib-resource-clone.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
- name: Configure resource clone {{ resource_clone.resource_id }}
2525
command:
26-
# pcs-0.10 supports only one set of attributes, that's the reason for
26+
# pcs supports only one set of attributes, that's the reason for
2727
# *_attrs[0] instead of looping over *_attrs
2828
cmd: >
2929
pcs -f {{ __ha_cluster_tempfile_cib_xml.path | quote }}

tasks/shell_pcs/pcs-cib-resource-primitive.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
---
33
- name: Configure resource primitive {{ resource.id }}
44
command:
5-
# pcs-0.10 supports only one set of attributes, that's the reason for
5+
# pcs supports only one set of attributes, that's the reason for
66
# *_attrs[0] instead of looping over *_attrs
77
cmd: >
88
pcs -f {{ __ha_cluster_tempfile_cib_xml.path | quote }}

0 commit comments

Comments
 (0)