From 2861a483d749388bae815d133cc4918259390e47 Mon Sep 17 00:00:00 2001 From: WingKai Ho Date: Mon, 6 Mar 2017 10:33:22 +0800 Subject: [PATCH] Update make-osd-partitions.yml When ansible do not load the file host_vars/{{ ansible_hostname }}.yml and host_vars/default.yml it will show syntactic err, so add keyword "skip" to fix it. Exit the playbook if the user not define devices in both host_vars/{{ ansible_hostname }}.yml and host_vars/default.yml host_vars/default.yml --- infrastructure-playbooks/make-osd-partitions.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/infrastructure-playbooks/make-osd-partitions.yml b/infrastructure-playbooks/make-osd-partitions.yml index 4adc5a644..1dd8db7a1 100644 --- a/infrastructure-playbooks/make-osd-partitions.yml +++ b/infrastructure-playbooks/make-osd-partitions.yml @@ -34,8 +34,15 @@ - name: load a variable file for devices partition   include_vars: "{{ item }}"   with_first_found: - - "host_vars/{{ ansible_hostname }}.yml" - - "host_vars/default.yml" + - files: + - "host_vars/{{ ansible_hostname }}.yml" + - "host_vars/default.yml" + skip: true + + - name: exit playbook, if devices not defined + fail: + msg: "devices must be define in host_vars/default.yml or host_vars/{{ ansible_hostname }}.yml" + when: devices is not defined - name: install sgdisk(gdisk) package: -- 2.39.5