Skip to content

Commit ff08d17

Browse files
author
Dmitriy Rabotjagov
committed
Add option to set node name as fqdn
Some software, that relies on corosync, checks nodes status by their FQDN (with crmadmin -S). And ansible inventory_hostname may not match with hosts FQDN. In this case you may set pacemaker_corosync_fqdn: true and fqdn will be used in corosync config instead of inventory_hostname.
1 parent 26a51fc commit ff08d17

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Deploys corosync/pacemaker on Ubuntu 14.04
77

88
- `pacemaker_corosync_group`: Ansible group name for corosync cluster (default: false, *mandatory*)
99
- `pacemaker_corosync_ring_interface`: Interface to use for ring0 communications (default: false, *mandatory*)
10+
- `pacemaker_corosync_fqdn`: Whether use inventory_hostname or ansible_fqdn as node name for corosync (default: false)
1011

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
pacemaker_corosync_fqdn: false
12
pacemaker_corosync_group: false
23
pacemaker_corosync_ring_interface: false

templates/corosync.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ nodelist {
3030
{% for node in groups[pacemaker_corosync_group]|sort %}
3131
node {
3232
ring0_addr: {{ hostvars[node]['ansible_' + pacemaker_corosync_ring_interface].ipv4.address }}
33-
name: {{ node }}
33+
name: {{ pacemaker_corosync_fqdn | bool | ternary(hostvars[node].ansible_fqdn, node) }}
3434
nodeid: {{ loop.index }}
3535
}
3636
{% endfor %}

0 commit comments

Comments
 (0)