From 0bc83d06f3a6dea4018be9b0636acc1dfce1a6ea Mon Sep 17 00:00:00 2001 From: caowei Date: Thu, 14 Dec 2017 15:52:09 +0800 Subject: [PATCH] Implement ceph-nfs service Change-Id: Ia909c62158acbec9d1dd926d45c66ac36e6b4244 Depends-On: I06325d4601128a0b5a2235370fa44012427c29e3 Implements: blueprint ceph-nfs-ganesha --- ansible/group_vars/all.yml | 1 + ansible/inventory/all-in-one | 3 +++ ansible/inventory/multinode | 3 +++ ansible/roles/ceph/defaults/main.yml | 4 +++ ansible/roles/ceph/tasks/config.yml | 4 +++ ansible/roles/ceph/tasks/deploy.yml | 3 +++ ansible/roles/ceph/tasks/pull.yml | 8 ++++++ ansible/roles/ceph/tasks/start_nfss.yml | 12 +++++++++ ansible/roles/ceph/tasks/upgrade.yml | 5 ++++ ansible/roles/ceph/templates/ceph-nfs.json.j2 | 24 +++++++++++++++++ ansible/roles/ceph/templates/ganesha.conf.j2 | 27 +++++++++++++++++++ etc/kolla/globals.yml | 1 + .../implement-ceph-nfs-ff8f9635c365923f.yaml | 5 ++++ 13 files changed, 100 insertions(+) create mode 100644 ansible/roles/ceph/tasks/start_nfss.yml create mode 100644 ansible/roles/ceph/templates/ceph-nfs.json.j2 create mode 100644 ansible/roles/ceph/templates/ganesha.conf.j2 create mode 100644 releasenotes/notes/implement-ceph-nfs-ff8f9635c365923f.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 97266584c6..7672556bad 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -382,6 +382,7 @@ enable_central_logging: "no" enable_ceph: "no" enable_ceph_mds: "no" enable_ceph_rgw: "no" +enable_ceph_nfs: "no" enable_chrony: "no" enable_cinder: "no" enable_cinder_backup: "yes" diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index 226d8ba07f..eeed4c7c6b 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -299,6 +299,9 @@ ceph [ceph-mgr:children] ceph +[ceph-nfs:children] +ceph + [ceph-mon:children] ceph diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index 58e7d3c56f..6eb956979d 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -318,6 +318,9 @@ ceph [ceph-mgr:children] ceph +[ceph-nfs:children] +ceph + [ceph-mon:children] ceph diff --git a/ansible/roles/ceph/defaults/main.yml b/ansible/roles/ceph/defaults/main.yml index abf9e7da71..0655c6724a 100644 --- a/ansible/roles/ceph/defaults/main.yml +++ b/ansible/roles/ceph/defaults/main.yml @@ -20,6 +20,10 @@ ceph_mgr_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker ceph_mgr_tag: "{{ ceph_tag }}" ceph_mgr_image_full: "{{ ceph_mgr_image }}:{{ ceph_mgr_tag }}" +ceph_nfs_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ ceph_install_type }}-ceph-nfs" +ceph_nfs_tag: "{{ ceph_tag }}" +ceph_nfs_image_full: "{{ ceph_nfs_image }}:{{ ceph_nfs_tag }}" + ceph_osd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ ceph_install_type }}-ceph-osd" ceph_osd_tag: "{{ ceph_tag }}" ceph_osd_image_full: "{{ ceph_osd_image }}:{{ ceph_osd_tag }}" diff --git a/ansible/roles/ceph/tasks/config.yml b/ansible/roles/ceph/tasks/config.yml index 8fc724b633..52abcae137 100644 --- a/ansible/roles/ceph/tasks/config.yml +++ b/ansible/roles/ceph/tasks/config.yml @@ -10,6 +10,7 @@ - "ceph-rgw" - "ceph-mgr" - "ceph-mds" + - "ceph-nfs" - name: Copying over config.json files for services template: @@ -28,6 +29,8 @@ group: "ceph-mgr" - name: "ceph-mds" group: "ceph-mds" + - name: "ceph-nfs" + group: "ceph-nfs" - name: Copying over ceph.conf vars: @@ -44,3 +47,4 @@ - "ceph-rgw" - "ceph-mgr" - "ceph-mds" + - "ceph-nfs" diff --git a/ansible/roles/ceph/tasks/deploy.yml b/ansible/roles/ceph/tasks/deploy.yml index 7026f7621b..937c064ad4 100644 --- a/ansible/roles/ceph/tasks/deploy.yml +++ b/ansible/roles/ceph/tasks/deploy.yml @@ -12,6 +12,9 @@ - include: start_mgrs.yml when: inventory_hostname in groups['ceph-mgr'] +- include: start_nfss.yml + when: inventory_hostname in groups['ceph-nfs'] + - include: bootstrap_osds.yml when: inventory_hostname in groups['ceph-osd'] diff --git a/ansible/roles/ceph/tasks/pull.yml b/ansible/roles/ceph/tasks/pull.yml index 225e3d15bb..bf59e2c883 100644 --- a/ansible/roles/ceph/tasks/pull.yml +++ b/ansible/roles/ceph/tasks/pull.yml @@ -36,3 +36,11 @@ when: - enable_ceph_mds | bool - inventory_hostname in groups['ceph-mds'] + +- name: Pulling ceph-nfs image + kolla_docker: + action: "pull_image" + common_options: "{{ docker_common_options }}" + image: "{{ ceph_nfs_image_full }}" + when: + - inventory_hostname in groups['ceph-nfs'] diff --git a/ansible/roles/ceph/tasks/start_nfss.yml b/ansible/roles/ceph/tasks/start_nfss.yml new file mode 100644 index 0000000000..8cf94d4280 --- /dev/null +++ b/ansible/roles/ceph/tasks/start_nfss.yml @@ -0,0 +1,12 @@ +--- +- name: Starting ceph-nfs container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + image: "{{ ceph_nfs_image_full }}" + name: "ceph_nfs" + volumes: + - "{{ node_config_directory }}/ceph-nfs/:{{ container_config_directory }}/:ro" + - "/etc/localtime:/etc/localtime:ro" + - "/var/run/dbus:/var/run/dbus" + - "kolla_logs:/var/log/kolla/" diff --git a/ansible/roles/ceph/tasks/upgrade.yml b/ansible/roles/ceph/tasks/upgrade.yml index 9e8a43664f..cc703e9ff0 100644 --- a/ansible/roles/ceph/tasks/upgrade.yml +++ b/ansible/roles/ceph/tasks/upgrade.yml @@ -19,3 +19,8 @@ when: - enable_ceph_mds | bool - inventory_hostname in groups['ceph-mds'] + +- include: start_nfss.yml + when: + - enable_ceph_nfs | bool + - inventory_hostname in groups['ceph-nfs'] diff --git a/ansible/roles/ceph/templates/ceph-nfs.json.j2 b/ansible/roles/ceph/templates/ceph-nfs.json.j2 new file mode 100644 index 0000000000..05d88924fc --- /dev/null +++ b/ansible/roles/ceph/templates/ceph-nfs.json.j2 @@ -0,0 +1,24 @@ +{ + "command": "/usr/bin/ganesha.nfsd -f /etc/ganesha/ganesha.conf", + "config_files": [ + { + "source": "{{ container_config_directory }}/ganesha.conf", + "dest": "/etc/ganesha/ganesha.conf", + "owner": "ceph", + "perm": "0600" + }, + { + "source": "{{ container_config_directory }}/ceph.conf", + "dest": "/etc/ceph/ceph.conf", + "owner": "ceph", + "perm": "0600" + }, + { + "source": "{{ container_config_directory }}/ceph.client.admin.keyring", + "dest": "/etc/ceph/ceph.client.admin.keyring", + "owner": "ceph", + "perm": "0600", + "optional": true + } + ] +} diff --git a/ansible/roles/ceph/templates/ganesha.conf.j2 b/ansible/roles/ceph/templates/ganesha.conf.j2 new file mode 100644 index 0000000000..ad86afbaf7 --- /dev/null +++ b/ansible/roles/ceph/templates/ganesha.conf.j2 @@ -0,0 +1,27 @@ +EXPORT +{ + Export_id=1; + + Path = "/"; + + Pseudo = /cephfs; + + Access_Type = RW; + + Protocols = 4; + + Transports = TCP; + + FSAL { + Name = CEPH; + User_Id = "admin"; + } +} + +LOG { + Facility { + name = FILE; + destination = "/var/log/kolla/ceph/ceph-nfs.log"; + enable = active; + } +} diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index a0002cb210..1877630183 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -144,6 +144,7 @@ kolla_internal_vip_address: "10.10.10.254" #enable_ceph: "no" #enable_ceph_mds: "no" #enable_ceph_rgw: "no" +#enable_ceph_nfs: "no" #enable_chrony: "no" #enable_cinder: "no" #enable_cinder_backup: "yes" diff --git a/releasenotes/notes/implement-ceph-nfs-ff8f9635c365923f.yaml b/releasenotes/notes/implement-ceph-nfs-ff8f9635c365923f.yaml new file mode 100644 index 0000000000..4f27e71a94 --- /dev/null +++ b/releasenotes/notes/implement-ceph-nfs-ff8f9635c365923f.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Implement ceph-nfs service, Nfs-ganesha can be used as a proxy when mounting + ceph file shares.