Skip to content

Commit 5c14d92

Browse files
Resolve the bug when launching cluster with 0 hosts.
1 parent 52f9d76 commit 5c14d92

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

inventory.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ ${bastion_name} ansible_host=${bastion_ip} ansible_user=${bastion_username} role
55
${host} ansible_host=${ip} ansible_user=${compute_username} role=compute
66
%{ endfor ~}
77
[nfs]
8+
%{ if nfs != "" }
89
${nfs} ansible_user=${compute_username} role=nfs
10+
%{ endif }
911
[all:children]
1012
bastion
1113
compute

playbooks/roles/etc-hosts/tasks/common.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ cluster_name }}"
3131
delegate_to: 127.0.0.1
3232
run_once: true
33-
when: not destroy|bool
33+
when: not destroy|bool and groups['compute']|length > 0
3434

3535
- name: add cluster nodes to the /etc/hosts file of the bastion
3636
blockinfile:
@@ -41,7 +41,7 @@
4141
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ cluster_name }}"
4242
delegate_to: 127.0.0.1
4343
run_once: true
44-
when: not destroy|bool
44+
when: not destroy|bool and groups['compute']|length > 0
4545

4646
- name: move /etc/hosts on all compute nodes
4747
become: true

0 commit comments

Comments
 (0)