From 8dc1554788d99fd54ae8be21636861014f6e03c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 15 May 2015 14:32:26 +0200 Subject: [PATCH] Fix multiple things MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix the Vagrantfile ruby check * fix the variable positions Bring more mandatory variables and try to separate Vagrant vars from the playbook vars. Signed-off-by: Sébastien Han --- Vagrantfile | 21 ++++++++++++++++--- group_vars/all | 6 +++--- roles/ceph-common/defaults/main.yml | 6 +++--- .../tasks/check-mandatory-vars.yml | 16 ++++++++++++++ roles/ceph-common/tasks/main.yml | 4 +--- 5 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 roles/ceph-common/tasks/check-mandatory-vars.yml diff --git a/Vagrantfile b/Vagrantfile index ff1277315..9a6c7615d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -30,23 +30,35 @@ ansible_provision = proc do |ansible| } # In a production deployment, these should be secret - if NMDSS != '0' && NRGWS != '0' + if NMDSS != 0 && NRGWS != 0 ansible.extra_vars = { fsid: '4a158d27-f750-41d5-9e7f-26ce4c9d2d45', monitor_secret: 'AQAWqilTCDh7CBAAawXt6kyTgLFCxSvJhTEmuw==', + journal_size: 100, + monitor_interface: 'eth1', + cluster_network: "#{SUBNET}.0/24", + public_network: "#{SUBNET}.0/24", radosgw: 'true', mds: 'true', } - elsif NMDSS != '0' + elsif NMDSS != 0 ansible.extra_vars = { fsid: '4a158d27-f750-41d5-9e7f-26ce4c9d2d45', monitor_secret: 'AQAWqilTCDh7CBAAawXt6kyTgLFCxSvJhTEmuw==', + journal_size: 100, + monitor_interface: 'eth1', + cluster_network: "#{SUBNET}.0/24", + public_network: "#{SUBNET}.0/24", mds: 'true', } - elsif NRGWS != '0' + elsif NRGWS != 0 ansible.extra_vars = { fsid: '4a158d27-f750-41d5-9e7f-26ce4c9d2d45', monitor_secret: 'AQAWqilTCDh7CBAAawXt6kyTgLFCxSvJhTEmuw==', + journal_size: 100, + monitor_interface: 'eth1', + cluster_network: "#{SUBNET}.0/24", + public_network: "#{SUBNET}.0/24", radosgw: 'true', } else @@ -54,6 +66,9 @@ ansible_provision = proc do |ansible| fsid: '4a158d27-f750-41d5-9e7f-26ce4c9d2d45', monitor_secret: 'AQAWqilTCDh7CBAAawXt6kyTgLFCxSvJhTEmuw==', journal_size: 100, + monitor_interface: 'eth1', + cluster_network: "#{SUBNET}.0/24", + public_network: "#{SUBNET}.0/24", } end ansible.limit = 'all' diff --git a/group_vars/all b/group_vars/all index 9b93157ca..6a3de3c99 100644 --- a/group_vars/all +++ b/group_vars/all @@ -61,7 +61,7 @@ dummy: ## Monitor options # -#monitor_interface: eth1 +#monitor_interface: interface #mon_osd_down_out_interval: 600 #mon_osd_min_down_reporters: 7 # number of OSDs per host + 1 #mon_clock_drift_allowed: .15 @@ -77,8 +77,8 @@ dummy: #pool_default_pgp_num: 128 #pool_default_size: 2 #pool_default_min_size: 1 -#cluster_network: 192.168.42.0/24 -#public_network: 192.168.42.0/24 +#cluster_network: 0.0.0.0/0 +#public_network: 0.0.0.0/0 #osd_mkfs_type: xfs #osd_mkfs_options_xfs: -f -i size=2048 #osd_mount_options_xfs: noatime diff --git a/roles/ceph-common/defaults/main.yml b/roles/ceph-common/defaults/main.yml index 9888a9b6d..49b0270db 100644 --- a/roles/ceph-common/defaults/main.yml +++ b/roles/ceph-common/defaults/main.yml @@ -72,7 +72,7 @@ debug_mds_level: 20 ## Monitor options # -monitor_interface: eth1 +monitor_interface: interface mon_osd_down_out_interval: 600 mon_osd_min_down_reporters: 7 # number of OSDs per host + 1 mon_clock_drift_allowed: .15 @@ -88,8 +88,8 @@ pool_default_pg_num: 128 pool_default_pgp_num: 128 pool_default_size: 2 pool_default_min_size: 1 -cluster_network: 192.168.42.0/24 -public_network: 192.168.42.0/24 +cluster_network: 0.0.0.0/0 +public_network: 0.0.0.0/0 osd_mkfs_type: xfs osd_mkfs_options_xfs: -f -i size=2048 osd_mount_options_xfs: noatime,largeio,inode64,swalloc diff --git a/roles/ceph-common/tasks/check-mandatory-vars.yml b/roles/ceph-common/tasks/check-mandatory-vars.yml new file mode 100644 index 000000000..d207bc1c4 --- /dev/null +++ b/roles/ceph-common/tasks/check-mandatory-vars.yml @@ -0,0 +1,16 @@ +--- +- 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/main.yml b/roles/ceph-common/tasks/main.yml index 791b0d43c..d15a596b9 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -35,9 +35,7 @@ register: cluster_uuid changed_when: False -- 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 +- include: check-mandatory-vars.yml - name: Generate Ceph configuration file template: >