]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
nfs: support internal Ganesha with external ceph cluster
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 20 May 2019 13:58:10 +0000 (15:58 +0200)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Thu, 6 Jun 2019 12:44:37 +0000 (12:44 +0000)
This commits allows to deploy an internal ganesha with an external ceph
cluster.

This requires to define `external_cluster_mon_ips` with a comma
separated list of external monitors.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1710358
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 6a6785b719d126cf54ebad8b2a22c97d90afd05e)

12 files changed:
group_vars/all.yml.sample
group_vars/clients.yml.sample
group_vars/rhcs.yml.sample
roles/ceph-client/defaults/main.yml
roles/ceph-client/tasks/create_users_keys.yml
roles/ceph-config/templates/ceph.conf.j2
roles/ceph-defaults/defaults/main.yml
roles/ceph-nfs/tasks/common.yml
roles/ceph-nfs/tasks/main.yml
roles/ceph-nfs/tasks/pre_requisite_container.yml
roles/ceph-nfs/tasks/pre_requisite_non_container.yml
roles/ceph-nfs/tasks/start_nfs.yml

index 72e672f511991dcb9eef55f849b631eb93d099dd..8c3dec90e08457779bcb0021ca6fe3553039f6c6 100644 (file)
@@ -474,7 +474,7 @@ dummy:
 # Set this to true to enable File access via NFS.  Requires an MDS role.
 #nfs_file_gw: false
 # Set this to true to enable Object access via NFS. Requires an RGW role.
-#nfs_obj_gw: true
+#nfs_obj_gw: "{{ False if groups.get(mon_group_name, []) | length == 0 else True }}"
 
 
 #############
index f1ae17b30d6bf01156b0b6bb1c3aede9f5176028..f1c8132a8a3465b49614de451476710879794d6e 100644 (file)
@@ -57,3 +57,4 @@ dummy:
 #  - { name: client.test, caps: { mon: "allow r", osd: "allow class-read object_prefix rbd_children, allow rwx pool=test" },  mode: "{{ ceph_keyring_permissions }}" }
 #  - { name: client.test2, caps: { mon: "allow r", osd: "allow class-read object_prefix rbd_children, allow rwx pool=test2" },  mode: "{{ ceph_keyring_permissions }}" }
 
+#ceph_nfs_ceph_user: { name: client.rgw.nfs0, key: 'SECRET==', caps: { mon: "allow rw", osd: "allow rwx" }, mode: "{{ ceph_keyring_permissions }}" }
index 9511571bd111289cfab0ea8cb0bdbe99dfc2655a..4cd9c45b6c8b4d3e62bc8af6e203667811f44e48 100644 (file)
@@ -474,7 +474,7 @@ ceph_rhcs_version: 4
 # Set this to true to enable File access via NFS.  Requires an MDS role.
 #nfs_file_gw: false
 # Set this to true to enable Object access via NFS. Requires an RGW role.
-#nfs_obj_gw: true
+#nfs_obj_gw: "{{ False if groups.get(mon_group_name, []) | length == 0 else True }}"
 
 
 #############
index 6f664db82854eb6b0fae5629e22294138a3e2d5a..d8e893b72596cd57f85306742c0c104efd972873 100644 (file)
@@ -48,3 +48,5 @@ pools:
 keys:
   - { name: client.test, caps: { mon: "allow r", osd: "allow class-read object_prefix rbd_children, allow rwx pool=test" },  mode: "{{ ceph_keyring_permissions }}" }
   - { name: client.test2, caps: { mon: "allow r", osd: "allow class-read object_prefix rbd_children, allow rwx pool=test2" },  mode: "{{ ceph_keyring_permissions }}" }
+
+#ceph_nfs_ceph_user: { name: client.rgw.nfs0, key: 'SECRET==', caps: { mon: "allow rw", osd: "allow rwx" }, mode: "{{ ceph_keyring_permissions }}" }
\ No newline at end of file
index bd13895848ffac167a338b0e93ff46b267530d26..c8ddff3bf7e866fdd3e4ed1bec95a2140bf853c9 100644 (file)
@@ -45,7 +45,9 @@
   environment:
     CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}"
     CEPH_CONTAINER_BINARY: "{{ container_binary }}"
-  with_items: "{{ keys }}"
+  with_items:
+    - "{{ keys }}"
+    - "{{ ceph_nfs_ceph_user | default([]) }}"
   delegate_to: "{{ delegated_node }}"
   when:
     - cephx
index 52c3e9a6b81ef6f3665af2e8b84d73a92ee618bf..1e5821052b6915a30c569e9afe16d50da24c7bec 100644 (file)
@@ -56,7 +56,7 @@ mon host = {% if nb_mon > 0 %}
 {%- endif %}
 {%- if not loop.last -%},{%- endif %}
 {%- endfor %}
-{% elif nb_mon == 0 and inventory_hostname in groups.get(client_group_name, []) %}
+{% elif nb_mon == 0 %}
 {{ external_cluster_mon_ips }}
 {% endif %}
 
index 967f4538511bde0e97331db4c6dd34503be54863..03b0e175b7391c8f4ba3cc1b287970da046e7cdc 100644 (file)
@@ -466,7 +466,7 @@ handler_health_mgr_check_delay: 10
 # Set this to true to enable File access via NFS.  Requires an MDS role.
 nfs_file_gw: false
 # Set this to true to enable Object access via NFS. Requires an RGW role.
-nfs_obj_gw: true
+nfs_obj_gw: "{{ False if groups.get(mon_group_name, []) | length == 0 else True }}"
 
 
 #############
index c086f8a987c901a6435d1c7d73c128804cc83621..6794ccd6079e1a997fbf0b32edd51db342cac2ec 100644 (file)
@@ -12,3 +12,4 @@
   when:
     - cephx
     - item.copy_key|bool
+    - groups.get(mon_group_name, []) | length > 0
index e1c71978fd3d681ea56d3fc3c04dc35c85e7581a..09766e68ee396f6a6c6e673840887a2606d8c35b 100644 (file)
@@ -17,6 +17,7 @@
 
 - name: include create_rgw_nfs_user.yml
   import_tasks: create_rgw_nfs_user.yml
+  when: groups.get(mon_group_name, []) | length > 0
 
 # NOTE (leseb): workaround for issues with ganesha and librgw
 - name: include ganesha_selinux_fix.yml
     - not containerized_deployment
     - ansible_os_family == 'RedHat'
 
+- name: copy rgw keyring when deploying internal ganesha with external ceph cluster
+  copy:
+    src: "/etc/ceph/{{ cluster }}.{{ ceph_nfs_ceph_user.name }}.keyring"
+    dest: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring"
+    mode: '0600'
+    owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+    group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+    remote_src: true
+  when:
+    - groups.get(mon_group_name, []) | length == 0
+    - ceph_nfs_ceph_user is defined
+
 - name: include start_nfs.yml
   import_tasks: start_nfs.yml
index 5206c128525f165ddf8f8dfa00feb46d3158ee82..ead1e19f6c90416ad7e26357ce2c958f23177932 100644 (file)
@@ -1,54 +1,58 @@
 ---
-- name: set_fact admin_keyring
-  set_fact:
-    admin_keyring:
-      - "/etc/ceph/{{ cluster }}.client.admin.keyring"
-  when: copy_admin_key
+- name: keyring related tasks
+  block:
+    - name: set_fact admin_keyring
+      set_fact:
+        admin_keyring:
+          - "/etc/ceph/{{ cluster }}.client.admin.keyring"
+      when: copy_admin_key
 
-- name: set_fact ceph_config_keys
-  set_fact:
-    ceph_config_keys:
-      - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
+    - name: set_fact ceph_config_keys
+      set_fact:
+        ceph_config_keys:
+          - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
 
-- name: merge ceph_config_keys and admin_keyring
-  set_fact:
-    ceph_config_keys: "{{ ceph_config_keys + admin_keyring }}"
-  when: copy_admin_key
+    - name: merge ceph_config_keys and admin_keyring
+      set_fact:
+        ceph_config_keys: "{{ ceph_config_keys + admin_keyring }}"
+      when: copy_admin_key
 
-- name: stat for config and keys
-  stat:
-    path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
-  delegate_to: localhost
-  with_items: "{{ ceph_config_keys }}"
-  changed_when: false
-  become: false
-  failed_when: false
-  check_mode: no
-  register: statconfig
+    - name: stat for config and keys
+      stat:
+        path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
+      delegate_to: localhost
+      with_items: "{{ ceph_config_keys }}"
+      changed_when: false
+      become: false
+      failed_when: false
+      check_mode: no
+      register: statconfig
 
-- name: try to fetch config and keys
-  copy:
-    src: "{{ fetch_directory }}/{{ fsid }}/{{ item.0 }}"
-    dest: "{{ item.0 }}"
-    owner: "64045"
-    group: "64045"
-    mode: 0644
-  changed_when: false
-  with_together:
-    - "{{ ceph_config_keys }}"
-    - "{{ statconfig.results }}"
-  when: item.1.stat.exists
+    - name: try to fetch config and keys
+      copy:
+        src: "{{ fetch_directory }}/{{ fsid }}/{{ item.0 }}"
+        dest: "{{ item.0 }}"
+        owner: "64045"
+        group: "64045"
+        mode: 0644
+      changed_when: false
+      with_together:
+        - "{{ ceph_config_keys }}"
+        - "{{ statconfig.results }}"
+      when: item.1.stat.exists
+  when: groups.get(mon_group_name, []) | length > 0
 
-- name: create dbus service file
-  become: true
-  copy:
-    src: "org.ganesha.nfsd.conf"
-    dest: /etc/dbus-1/system.d/org.ganesha.nfsd.conf
-    owner: "root"
-    group: "root"
-    mode: "0644"
-  when: ceph_nfs_dynamic_exports
+- name: dbus related tasks
+  block:
+    - name: create dbus service file
+      become: true
+      copy:
+        src: "org.ganesha.nfsd.conf"
+        dest: /etc/dbus-1/system.d/org.ganesha.nfsd.conf
+        owner: "root"
+        group: "root"
+        mode: "0644"
 
-- name: reload dbus configuration
-  command: "killall -SIGHUP dbus-daemon"
+    - name: reload dbus configuration
+      command: "killall -SIGHUP dbus-daemon"
   when: ceph_nfs_dynamic_exports
index f88f67ffd4a25d24be0288ed278a0db15c21c65a..1b1868a2cf64d50da00bd0e23639ec03c9a8c897 100644 (file)
@@ -42,7 +42,9 @@
   when: item.create|bool
 
 - name: cephx related tasks
-  when: cephx
+  when:
+    - cephx
+    - groups.get(mon_group_name, []) | length > 0
   block:
     - name: copy bootstrap cephx keys
       copy:
index 28a5ea25542a111f0b80623b67f0b5acc694e9d2..0e7aa959ac668db5fbe78ff5945353e28fed003a 100644 (file)
@@ -1,26 +1,28 @@
 ---
-- name: set_fact container_exec_cmd_nfs
-  set_fact:
-    container_exec_cmd_nfs: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
-  when: containerized_deployment
+- block:
+  - name: set_fact container_exec_cmd_nfs
+    set_fact:
+      container_exec_cmd_nfs: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
+    when: containerized_deployment
 
-- name: check if rados index object exists
-  shell: "{{ container_exec_cmd_nfs | default('') }} rados -p {{ cephfs_data }} --cluster {{ cluster }} ls|grep {{ ceph_nfs_rados_export_index }}"
-  changed_when: false
-  failed_when: false
-  register: rados_index_exists
-  check_mode: no
-  when: ceph_nfs_rados_backend
-  delegate_to: "{{ groups[mon_group_name][0] }}"
-  run_once: true
+  - name: check if rados index object exists
+    shell: "{{ container_exec_cmd_nfs | default('') }} rados -p {{ cephfs_data }} --cluster {{ cluster }} ls|grep {{ ceph_nfs_rados_export_index }}"
+    changed_when: false
+    failed_when: false
+    register: rados_index_exists
+    check_mode: no
+    when: ceph_nfs_rados_backend
+    delegate_to: "{{ groups[mon_group_name][0] }}"
+    run_once: true
 
-- name: create an empty rados index object
-  command: "{{ container_exec_cmd_nfs | default('') }} rados -p {{ cephfs_data }} --cluster {{ cluster }} put {{ ceph_nfs_rados_export_index }} /dev/null"
-  when:
-    - ceph_nfs_rados_backend
-    - rados_index_exists.rc != 0
-  delegate_to: "{{ groups[mon_group_name][0] }}"
-  run_once: true
+  - name: create an empty rados index object
+    command: "{{ container_exec_cmd_nfs | default('') }} rados -p {{ cephfs_data }} --cluster {{ cluster }} put {{ ceph_nfs_rados_export_index }} /dev/null"
+    when:
+      - ceph_nfs_rados_backend
+      - rados_index_exists.rc != 0
+    delegate_to: "{{ groups[mon_group_name][0] }}"
+    run_once: true
+  when: groups.get(mon_group_name, []) | length > 0
 
 - name: create /etc/ganesha
   file: