Skip to content

Commit 62f4b6d

Browse files
committed
Add cephadm_hostname to enter/exit maintenance roles
Some systems do not use ansible_facts.nodename.
1 parent 76921e1 commit 62f4b6d

File tree

6 files changed

+9
-5
lines changed

6 files changed

+9
-5
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
cephadm_hostname: "{{ ansible_facts.nodename }}"

roles/enter_maintenance/tasks/enter.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name: stackhpc.cephadm.commands
55
vars:
66
cephadm_commands:
7-
- "orch host ok-to-stop {{ ansible_facts.nodename }}"
7+
- "orch host ok-to-stop {{ cephadm_hostname }}"
88

99
# Annoyingly, 'ceph orch host ok-to-stop' does not exit non-zero when
1010
# it is not OK to stop, so we need to check for specific messages.
@@ -30,4 +30,4 @@
3030
name: stackhpc.cephadm.commands
3131
vars:
3232
cephadm_commands:
33-
- "orch host maintenance enter {{ ansible_facts.nodename }}"
33+
- "orch host maintenance enter {{ cephadm_hostname }}"

roles/enter_maintenance/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Entering maintenance fails if the host is already in maintenance.
1818
- name: Enter maintenance
1919
ansible.builtin.include_tasks: enter.yml
20-
when: ansible_facts.nodename not in cephadm_hosts_in_maintenance
20+
when: cephadm_hostname not in cephadm_hosts_in_maintenance
2121
vars:
2222
cephadm_hosts_in_maintenance: >-
2323
{{ cephadm_commands_result.results[0].stdout |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
cephadm_hostname: "{{ ansible_facts.nodename }}"

roles/exit_maintenance/tasks/exit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
name: stackhpc.cephadm.commands
55
vars:
66
cephadm_commands:
7-
- "orch host maintenance exit {{ ansible_facts.nodename }}"
7+
- "orch host maintenance exit {{ cephadm_hostname }}"

roles/exit_maintenance/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
cephadm_host_status: >-
2222
{{ cephadm_commands_result.results[0].stdout |
2323
from_json |
24-
selectattr('hostname', 'equalto', ansible_facts.nodename) |
24+
selectattr('hostname', 'equalto', cephadm_hostname) |
2525
first }}

0 commit comments

Comments
 (0)