]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Use more variable check 315/head
authorleseb <seb@redhat.com>
Fri, 3 Jul 2015 18:18:41 +0000 (20:18 +0200)
committerleseb <seb@redhat.com>
Fri, 3 Jul 2015 19:38:30 +0000 (21:38 +0200)
Fail early if a variable is not defined.

Signed-off-by: leseb <seb@redhat.com>
Vagrantfile
group_vars/all
roles/ceph-common/tasks/check-mandatory-vars.yml [deleted file]
roles/ceph-common/tasks/check_mandatory_vars.yml [new file with mode: 0644]
roles/ceph-common/tasks/main.yml
roles/ceph-mon/tasks/start_monitor.yml
roles/ceph-osd/defaults/main.yml

index 8d2db6c3f967d8e7a377fc4041bb30a78fdca5ae..842aff0cd94a6d0887f3ec3fdd5c6e513d4de237 100644 (file)
@@ -40,6 +40,7 @@ ansible_provision = proc do |ansible|
     monitor_interface: 'eth1',
     cluster_network: "#{SUBNET}.0/24",
     public_network: "#{SUBNET}.0/24",
+    devices: "[ '/dev/sdb', '/dev/sdc' ]",
   }
   ansible.limit = 'all'
 end
index 8f9a32a722d55d7e11cdd36c875696744cc1f5c3..3a0e504b7c402eb42eec1a0cb056b41719a7a1cf 100644 (file)
@@ -102,6 +102,7 @@ dummy:
 ## Monitor options
 #
 #monitor_interface: interface
+#monitor_secret:
 #mon_osd_down_out_interval: 600
 #mon_osd_min_down_reporters: 7 # number of OSDs per host + 1
 #mon_clock_drift_allowed: .15
diff --git a/roles/ceph-common/tasks/check-mandatory-vars.yml b/roles/ceph-common/tasks/check-mandatory-vars.yml
deleted file mode 100644 (file)
index 47ac231..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
----
-- name: make sure journal_size configured
-  fail: msg="journal_size must be configured. See http://ceph.com/docs/master/rados/configuration/osd-config-ref/"
-  when: journal_size|int == 0
-
-- name: make sure monitor_interface configured
-  fail: msg="monitor_interface must be configured. Interface for the monitor to listen on"
-  when: monitor_interface == 'interface'
-
-- name: make sure cluster_network configured
-  fail: msg="cluster_network must be configured. Ceph replication network"
-  when: cluster_network == '0.0.0.0/0'
-
-- name: make sure public_network configured
-  fail: msg="public_network must be configured. Ceph public network"
-  when: public_network == '0.0.0.0/0'
diff --git a/roles/ceph-common/tasks/check_mandatory_vars.yml b/roles/ceph-common/tasks/check_mandatory_vars.yml
new file mode 100644 (file)
index 0000000..472796a
--- /dev/null
@@ -0,0 +1,65 @@
+---
+- name: make sure an installation source was chosen
+  fail: msg="choose an installation source or read https://github.com/ceph/ceph-ansible/wiki"
+  when:
+    not ceph_stable and
+    not ceph_dev and
+    not ceph_stable_ice and
+    not ceph_stable_rh_storage
+
+- name: verify that a method was chosen for red hat storage
+  fail: msg="choose between ceph_stable_rh_storage_cdn_install and ceph_stable_rh_storage_iso_install"
+  when:
+    ceph_stable_rh_storage and
+    not ceph_stable_rh_storage_cdn_install and
+    not ceph_stable_rh_storage_iso_install
+
+- name: make sure a monitor secret is defined
+  fail: msg"monitor_secret must be defined. Go edit group_vars/all or read https://github.com/ceph/ceph-ansible/wiki"
+  when: monitor_secret is not defined
+
+- name: make sure journal_size configured
+  fail: msg="journal_size must be configured. See http://ceph.com/docs/master/rados/configuration/osd-config-ref/"
+  when: journal_size|int == 0
+
+- name: make sure monitor_interface configured
+  fail: msg="monitor_interface must be configured. Interface for the monitor to listen on"
+  when: monitor_interface == 'interface'
+
+- name: make sure cluster_network configured
+  fail: msg="cluster_network must be configured. Ceph replication network"
+  when: cluster_network == '0.0.0.0/0'
+
+- name: make sure public_network configured
+  fail: msg="public_network must be configured. Ceph public network"
+  when: public_network == '0.0.0.0/0'
+
+- name: make sure an osd scenario was chosen
+  fail: msg="please choose an osd scenario"
+  when:
+    osd_group_name is defined and
+    not journal_collocation and
+    not raw_multi_journal and
+    not osd_directory
+
+- name: verify devices have been provided
+  fail: msg="please provide devices to your osd scenario"
+  when:
+    osd_group_name is defined and
+    (journal_collocation or raw_multi_journal) and
+    devices is not defined
+
+- name: verify journal devices have been provided
+  fail: msg="please provide devices to your osd scenario"
+  when:
+    osd_group_name is defined and
+    raw_multi_journal and
+    raw_journal_devices is not defined
+
+- name: verify directories have been provided
+  fail: msg="please provide directories to your osd scenario"
+  when:
+    osd_group_name is defined and
+    osd_group_name in group_names and
+    osd_directory and
+    osd_directories is not defined
index 5144ff8aded3264cd93bd6fdd1630253d278d383..d8fb3450783497a256bde266f9854076879ebf4a 100644 (file)
@@ -1,6 +1,8 @@
 ---
 - include: os_check.yml
 
+- include: check_mandatory_vars.yml
+
 - include: os_tuning.yml
   when: osd_group_name in group_names
 
@@ -48,8 +50,6 @@
   register: cluster_uuid
   sudo: false
 
-- include: check-mandatory-vars.yml
-
 - name: generate Ceph configuration file
   template: >
     src=ceph.conf.j2
index 7c78680e6214749e95c560c1ee108cde0f55f738..62937a21fc3b0e559f2c222dea41725dd7b6f971 100644 (file)
@@ -24,6 +24,7 @@
 # as a safety measure we run the raw command
 - name: start and add that the monitor service to the init sequence
   command: service ceph start mon
+  changed_when: false
   when: ansible_distribution != "Ubuntu"
 
 - name: collect admin and bootstrap keys
index 368f3c3224c6d0e418f1162bfb55245a13b59de9..c32b25614626eed1d6979e8d42b5a0df0ae1730b 100644 (file)
@@ -48,9 +48,9 @@ zap_devices: false
 # Declare devices\r
 # All the scenarii inherit from the following device declaration\r
 #\r
-devices:\r
-  - /dev/sdb\r
-  - /dev/sdc\r
+#devices:\r
+#  - /dev/sdb\r
+#  - /dev/sdc\r
 \r
 # Device discovery is based on the Ansible fact 'ansible_devices'\r
 # which reports all the devices on a system. If chosen all the disks\r
@@ -86,22 +86,20 @@ journal_collocation: false
 # 2. Progressively add new devices\r
 \r
 raw_multi_journal: false\r
-raw_journal_devices:\r
-  - /dev/sdb\r
-  - /dev/sdb\r
-  - /dev/sdc\r
-  - /dev/sdc\r
+#raw_journal_devices:\r
+#  - /dev/sdb\r
+#  - /dev/sdb\r
+#  - /dev/sdc\r
+#  - /dev/sdc\r
 \r
 \r
 # IV. Fourth scenario: use directory instead of disk for OSDs\r
 # Use 'true' to enable this scenario\r
 \r
 osd_directory: false\r
-osd_directories:\r
-  - /var/lib/ceph/osd/mydir1\r
-  - /var/lib/ceph/osd/mydir2\r
-  - /var/lib/ceph/osd/mydir3\r
-  - /var/lib/ceph/osd/mydir4\r
+#osd_directories:\r
+#  - /var/lib/ceph/osd/mydir1\r
+#  - /var/lib/ceph/osd/mydir2\r
 \r
 \r
 ##########\r