From c670004de2b0e4bbd475abf47015c6fdc0013b64 Mon Sep 17 00:00:00 2001 From: leseb Date: Thu, 2 Jul 2015 11:08:59 +0200 Subject: [PATCH] Cleanup daemon declaration Now we don't need to activate the services through a variable. If the role is activated in the inventory, actions will occur automatically. Fixing the repo creation for red hat storage too. Signed-off-by: leseb --- Vagrantfile | 74 ++++++------------- group_vars/all | 12 +-- group_vars/mons | 8 -- roles/ceph-common/defaults/main.yml | 9 +-- roles/ceph-common/tasks/install_on_redhat.yml | 9 +++ .../tasks/prerequisite_rh_storage.yml | 3 - roles/ceph-common/templates/ceph.conf.j2 | 6 +- roles/ceph-mon/defaults/main.yml | 8 -- roles/ceph-mon/tasks/ceph_keys.yml | 2 +- roles/ceph-mon/tasks/main.yml | 2 +- site.yml | 2 +- 11 files changed, 42 insertions(+), 93 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 9a6c7615d..93aa06ec8 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,13 +7,13 @@ VAGRANTFILE_API_VERSION = '2' config_file=File.expand_path(File.join(File.dirname(__FILE__), 'vagrant_variables.yml')) settings=YAML.load_file(config_file) -NMONS = settings['mon_vms'] -NOSDS = settings['osd_vms'] -NMDSS = settings['mds_vms'] -NRGWS = settings['rgw_vms'] -CLIENTS = settings['client_vms'] -SUBNET = settings['subnet'] -BOX = settings['vagrant_box'] +NMONS = settings['mon_vms'] +NOSDS = settings['osd_vms'] +NMDSS = settings['mds_vms'] +NRGWS = settings['rgw_vms'] +CLIENTS = settings['client_vms'] +SUBNET = settings['subnet'] +BOX = settings['vagrant_box'] MEMORY = settings['memory'] ansible_provision = proc do |ansible| @@ -22,55 +22,23 @@ ansible_provision = proc do |ansible| # these aren't supported by Vagrant, see # https://github.com/mitchellh/vagrant/issues/3539 ansible.groups = { - 'mons' => (0..NMONS - 1).map { |j| "mon#{j}" }, - 'osds' => (0..NOSDS - 1).map { |j| "osd#{j}" }, - 'mdss' => (0..NMDSS - 1).map { |j| "mds#{j}" }, - 'rgws' => (0..NRGWS - 1).map { |j| "rgw#{j}" }, - 'clients' => (0..CLIENTS - 1).map { |j| "client#{j}" } + 'mons' => (0..NMONS - 1).map { |j| "mon#{j}" }, + 'restapis' => (0..NMONS - 1).map { |j| "mon#{j}" }, + 'osds' => (0..NOSDS - 1).map { |j| "osd#{j}" }, + 'mdss' => (0..NMDSS - 1).map { |j| "mds#{j}" }, + 'rgws' => (0..NRGWS - 1).map { |j| "rgw#{j}" }, + 'clients' => (0..CLIENTS - 1).map { |j| "client#{j}" } } # In a production deployment, these should be secret - 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 - 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 - 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 - 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", - } - end + 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", + } ansible.limit = 'all' end diff --git a/group_vars/all b/group_vars/all index 8eb39e170..a9630984e 100644 --- a/group_vars/all +++ b/group_vars/all @@ -12,6 +12,7 @@ dummy: #osd_group_name: osds #rgw_group_name: rgws #mds_group_name: mdss +#restapi_group_name: restapis # /!\ EITHER ACTIVE ceph_stable OR ceph_stable_ice OR ceph_dev /!\ @@ -90,7 +91,7 @@ dummy: #rbd_client_directories: false # this will create rbd_client_log_path and rbd_client_admin_socket_path directories with proper permissions, this WON'T work if libvirt and kvm are installed #rbd_client_log_file: /var/log/rbd-clients/qemu-guest-$pid.log # must be writable by QEMU and allowed by SELinux or AppArmor #rbd_client_log_path: /var/log/rbd-clients/ -#rbd_client_admin_socket_path: /var/run/ceph/rbd-clients/$cluster-$type.$id.$pid.$cctid.asok +#rbd_client_admin_socket_path: /var/run/ceph/rbd-clients/ ## Monitor options # @@ -145,13 +146,8 @@ dummy: #osd_scrub_chunk_max: 5 #osd_deep_scrub_stride: 1048576 -## MDS options -# -#mds: false # disable mds configuration in ceph.conf - # Rados Gateway options # -#radosgw: false # referenced in monitor role too. #radosgw_dns_name: your.subdomain.tld # subdomains used by radosgw. See http://ceph.com/docs/master/radosgw/config/#enabling-subdomain-s3-calls #radosgw_frontend: civetweb # supported options are 'apache' or 'civetweb', also edit roles/ceph-radosgw/defaults/main.yml #radosgw_civetweb_port: 80 @@ -166,8 +162,8 @@ dummy: ## REST API options # -#restapi: false # disable restapi configuration in ceph.conf -#restapi_public_addr: 0.0.0.0:5000 +#restapi_interface: "{{ monitor_interface }}" +#restapi_port: 5000 #restapi_base_url: /api/v0.1 #restapi_log_level: warning diff --git a/group_vars/mons b/group_vars/mons index 5258fab52..690b1d007 100644 --- a/group_vars/mons +++ b/group_vars/mons @@ -14,20 +14,12 @@ dummy: # monitor_secret: #cephx: true -# Rados Gateway options -# referenced in common role too. -#radosgw: false - # CephFS #pool_default_pg_num: 128 #cephfs_data: cephfs_data #cephfs_metadata: cephfs_metadata #cephfs: cephfs -# Ceph REST API -# referenced in common role too. -#restapi: false - # Secure your cluster # This will set the following flags on all the pools: # * nosizechange diff --git a/roles/ceph-common/defaults/main.yml b/roles/ceph-common/defaults/main.yml index 251570efe..f7df697ca 100644 --- a/roles/ceph-common/defaults/main.yml +++ b/roles/ceph-common/defaults/main.yml @@ -9,6 +9,7 @@ mon_group_name: mons osd_group_name: osds rgw_group_name: rgws mds_group_name: mdss +restapi_group_name: restapis # /!\ EITHER ACTIVE ceph_stable OR ceph_stable_ice OR ceph_dev /!\ @@ -155,13 +156,8 @@ osd_disk_thread_ioprio_priority: 0 osd_scrub_chunk_max: 5 osd_deep_scrub_stride: 1048576 -## MDS options -# -mds: false # disable mds configuration in ceph.conf - ## Rados Gateway options # -radosgw: false # referenced in monitor role too. #radosgw_dns_name: your.subdomain.tld # subdomains used by radosgw. See http://ceph.com/docs/master/radosgw/config/#enabling-subdomain-s3-calls radosgw_frontend: civetweb # supported options are 'apache' or 'civetweb', also edit roles/ceph-radosgw/defaults/main.yml radosgw_civetweb_port: 80 @@ -176,8 +172,7 @@ radosgw_nss_db_path: /var/lib/ceph/radosgw/ceph-radosgw.{{ ansible_hostname }}/n ## REST API options # -restapi: false # disable restapi configuration in ceph.conf -restapi_interface: eth1 +restapi_interface: "{{ monitor_interface }}" restapi_port: 5000 restapi_base_url: /api/v0.1 restapi_log_level: warning # available level are: critical, error, warning, info, debug diff --git a/roles/ceph-common/tasks/install_on_redhat.yml b/roles/ceph-common/tasks/install_on_redhat.yml index be163d73f..1d897c244 100644 --- a/roles/ceph-common/tasks/install_on_redhat.yml +++ b/roles/ceph-common/tasks/install_on_redhat.yml @@ -53,6 +53,15 @@ mode=0644 when: ceph_stable_ice +- name: add red hat storage repository + template: > + src=redhat_storage_repo.j2 + dest=/etc/yum.repos.d/rh_storage.repo + owner=root + group=root + mode=0644 + when: ceph_stable_rh_storage + - name: install Ceph yum: > name=ceph diff --git a/roles/ceph-common/tasks/prerequisite_rh_storage.yml b/roles/ceph-common/tasks/prerequisite_rh_storage.yml index 496b1f40a..c4bbd724f 100644 --- a/roles/ceph-common/tasks/prerequisite_rh_storage.yml +++ b/roles/ceph-common/tasks/prerequisite_rh_storage.yml @@ -3,9 +3,6 @@ file: > path={{ ceph_stable_rh_storage_mount_path }} state=directory - owner=root - group=root - mode=0644 - name: get red hat storage packages get_url: > diff --git a/roles/ceph-common/templates/ceph.conf.j2 b/roles/ceph-common/templates/ceph.conf.j2 index 98f4e178c..29c690bf6 100644 --- a/roles/ceph-common/templates/ceph.conf.j2 +++ b/roles/ceph-common/templates/ceph.conf.j2 @@ -124,7 +124,7 @@ osd scrub chunk max = {{ osd_scrub_chunk_max }} osd deep scrub stride = {{ osd_deep_scrub_stride }} -{% if mds %} +{% if groups[mds_group_name] is defined %} [mds] {% if enable_debug_mds %} debug mds = {{ debug_mds_level }} @@ -140,7 +140,7 @@ {% endfor %} {% endif %} -{% if radosgw %} +{% if groups[mds_group_name] is defined %} {% for host in groups[rgw_group_name] %} {% if hostvars[host]['ansible_hostname'] is defined %} [client.rgw.{{ hostvars[host]['ansible_hostname'] }}] @@ -169,7 +169,7 @@ {% endfor %} {% endif %} -{% if restapi %} +{% if groups[restapi_group_name] is defined %} [client.restapi] public addr = {{ hostvars[inventory_hostname]['ansible_' + restapi_interface]['ipv4']['address'] }}:{{ restapi_port }} restapi base url = {{ restapi_base_url }} diff --git a/roles/ceph-mon/defaults/main.yml b/roles/ceph-mon/defaults/main.yml index 8e0b7395d..9d0b7b3c7 100644 --- a/roles/ceph-mon/defaults/main.yml +++ b/roles/ceph-mon/defaults/main.yml @@ -12,20 +12,12 @@ fsid: "{{ cluster_uuid.stdout }}" # monitor_secret: cephx: true -# Rados Gateway options -# referenced in common role too. -radosgw: false - # CephFS pool_default_pg_num: 128 cephfs_data: cephfs_data cephfs_metadata: cephfs_metadata cephfs: cephfs -# Ceph REST API -# referenced in common role too. -restapi: false - # Secure your cluster # This will set the following flags on all the pools: # * nosizechange diff --git a/roles/ceph-mon/tasks/ceph_keys.yml b/roles/ceph-mon/tasks/ceph_keys.yml index babac4a3e..7465db5af 100644 --- a/roles/ceph-mon/tasks/ceph_keys.yml +++ b/roles/ceph-mon/tasks/ceph_keys.yml @@ -11,7 +11,7 @@ changed_when: false when: cephx and - restapi + groups[restapi_group_name] is defined - include: openstack_config.yml when: diff --git a/roles/ceph-mon/tasks/main.yml b/roles/ceph-mon/tasks/main.yml index d56151e32..bcbc52d98 100644 --- a/roles/ceph-mon/tasks/main.yml +++ b/roles/ceph-mon/tasks/main.yml @@ -11,7 +11,7 @@ - include: create_mds_filesystems.yml when: not ceph_containerized_deployment and - mds + mds_group_name is defined - include: secure_cluster.yml when: diff --git a/site.yml b/site.yml index 8fa57d553..ff4ebcfcf 100644 --- a/site.yml +++ b/site.yml @@ -5,7 +5,7 @@ sudo: True roles: - ceph-mon - - { role: ceph-restapi, when: restapi } + - ceph-restapi - hosts: osds sudo: True -- 2.47.3