]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Cleanup daemon declaration 304/head
authorleseb <seb@redhat.com>
Thu, 2 Jul 2015 09:08:59 +0000 (11:08 +0200)
committerleseb <seb@redhat.com>
Thu, 2 Jul 2015 13:22:18 +0000 (15:22 +0200)
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 <seb@redhat.com>
Vagrantfile
group_vars/all
group_vars/mons
roles/ceph-common/defaults/main.yml
roles/ceph-common/tasks/install_on_redhat.yml
roles/ceph-common/tasks/prerequisite_rh_storage.yml
roles/ceph-common/templates/ceph.conf.j2
roles/ceph-mon/defaults/main.yml
roles/ceph-mon/tasks/ceph_keys.yml
roles/ceph-mon/tasks/main.yml
site.yml

index 9a6c7615dc5368b38fae8df6492c4d9e603e05c2..93aa06ec83cdff07c95e3046ba7058dffb9f789c 100644 (file)
@@ -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
 
index 8eb39e1702b3d86b5eaff98405839d75cd243f61..a9630984e8f538086441559d333e5bd30ee41425 100644 (file)
@@ -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
 
index 5258fab52dd35dfd170efaee42e286dc8d58f9f6..690b1d0072a80870015c6a49d553018fb0faa831 100644 (file)
@@ -14,20 +14,12 @@ dummy:
 # monitor_secret:\r
 #cephx: true\r
 \r
-# Rados Gateway options\r
-# referenced in common role too.\r
-#radosgw: false\r
-\r
 # CephFS\r
 #pool_default_pg_num: 128\r
 #cephfs_data: cephfs_data\r
 #cephfs_metadata: cephfs_metadata\r
 #cephfs: cephfs\r
 \r
-# Ceph REST API\r
-# referenced in common role too.\r
-#restapi: false\r
-\r
 # Secure your cluster\r
 # This will set the following flags on all the pools:\r
 # * nosizechange\r
index 251570efee87ec6944bc2d3a701d5a07b0584054..f7df697cad3cef24c056e42e5cad4428c4e99358 100644 (file)
@@ -9,6 +9,7 @@ mon_group_name: mons
 osd_group_name: osds\r
 rgw_group_name: rgws\r
 mds_group_name: mdss\r
+restapi_group_name: restapis\r
 \r
 # /!\ EITHER ACTIVE ceph_stable OR ceph_stable_ice OR ceph_dev /!\\r
 \r
@@ -155,13 +156,8 @@ osd_disk_thread_ioprio_priority: 0
 osd_scrub_chunk_max: 5\r
 osd_deep_scrub_stride: 1048576\r
 \r
-## MDS options\r
-#\r
-mds: false # disable mds configuration in ceph.conf\r
-\r
 ## Rados Gateway options\r
 #\r
-radosgw: false # referenced in monitor role too.\r
 #radosgw_dns_name: your.subdomain.tld # subdomains used by radosgw. See http://ceph.com/docs/master/radosgw/config/#enabling-subdomain-s3-calls\r
 radosgw_frontend: civetweb # supported options are 'apache' or 'civetweb', also edit roles/ceph-radosgw/defaults/main.yml\r
 radosgw_civetweb_port: 80\r
@@ -176,8 +172,7 @@ radosgw_nss_db_path: /var/lib/ceph/radosgw/ceph-radosgw.{{ ansible_hostname }}/n
 \r
 ## REST API options\r
 #\r
-restapi: false # disable restapi configuration in ceph.conf\r
-restapi_interface: eth1\r
+restapi_interface: "{{ monitor_interface }}"\r
 restapi_port: 5000\r
 restapi_base_url: /api/v0.1\r
 restapi_log_level: warning # available level are: critical, error, warning, info, debug\r
index be163d73f435a065f5628cf39a5501fead7d8e96..1d897c2449612a3b8f2a9bdf0deb60747086a1c4 100644 (file)
     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
index 496b1f40a8878b715fc236789e244b7c92ee4455..c4bbd724f9ec02a036d536b21cdc64b86212281a 100644 (file)
@@ -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: >
index 98f4e178ce566dd4935bc7ca3c4ab51a36e7d152..29c690bf6c1a1d5243a5e593694d1bd51a3988d2 100644 (file)
   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 }}
 {% 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'] }}]
 {% 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 }}
index 8e0b7395dbb34335c0d004cf8a014df0e803c769..9d0b7b3c7a0145a400814e9535702777943bff06 100644 (file)
@@ -12,20 +12,12 @@ fsid: "{{ cluster_uuid.stdout }}"
 # monitor_secret:\r
 cephx: true\r
 \r
-# Rados Gateway options\r
-# referenced in common role too.\r
-radosgw: false\r
-\r
 # CephFS\r
 pool_default_pg_num: 128\r
 cephfs_data: cephfs_data\r
 cephfs_metadata: cephfs_metadata\r
 cephfs: cephfs\r
 \r
-# Ceph REST API\r
-# referenced in common role too.\r
-restapi: false\r
-\r
 # Secure your cluster\r
 # This will set the following flags on all the pools:\r
 # * nosizechange\r
index babac4a3e8745efb327b7a8ecc85e18c9d88ee0c..7465db5af3fd6dc8b20a0cd36f5fe2996cb15f3a 100644 (file)
@@ -11,7 +11,7 @@
   changed_when: false
   when:
     cephx and
-    restapi
+    groups[restapi_group_name] is defined
 
 - include: openstack_config.yml
   when:
index d56151e32a5b495ce838a4341bf7661cac93824d..bcbc52d98ddd998826d76aa0f5cff42677ca15a9 100644 (file)
@@ -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:
index 8fa57d553ddcf0c673f433fe836a226fc352af9e..ff4ebcfcf8e8ac9edb4041ebdf129880fcfab28a 100644 (file)
--- 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