From 55724c6e932a8835cd9e4e6365759115947071ca Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Mon, 21 Aug 2017 08:38:21 -0400 Subject: [PATCH] nfs-ganesha: add dev, stable, and rhcs nfs-ganesha's for ceph-nfs role Signed-off-by: Ali Maredia --- group_vars/all.yml.sample | 18 ++++++++-- group_vars/nfss.yml.sample | 28 +++++---------- group_vars/rhcs.yml.sample | 18 ++++++++-- .../installs/debian_community_repository.yml | 11 +++--- .../tasks/installs/debian_dev_repository.yml | 21 ++++++++++++ .../install_debian_enterprise_packages.yml | 18 +++++++++- .../installs/install_debian_packages.yml | 19 ++++++++--- .../installs/install_redhat_packages.yml | 12 ++----- .../installs/redhat_community_repository.yml | 13 +++++++ .../tasks/installs/redhat_dev_repository.yml | 21 ++++++++++++ roles/ceph-defaults/defaults/main.yml | 18 ++++++++-- roles/ceph-nfs/defaults/main.yml | 27 +++++---------- roles/ceph-nfs/tasks/pre_requisite.yml | 34 +++++++++++-------- 13 files changed, 177 insertions(+), 81 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 17bcda687..22529125d 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -138,6 +138,11 @@ dummy: #ceph_stable_release: dummy #ceph_stable_repo: "{{ ceph_mirror }}/debian-{{ ceph_stable_release }}" +#nfs_ganesha_stable: true # use stable repos for nfs-ganesha +#nfs_ganesha_stable_branch: V2.5-stable +#nfs_ganesha_stable_deb_repo: "{{ ceph_mirror }}/nfs-ganesha/deb-{{ nfs_ganesha_stable_branch }}/{{ ceph_stable_release }}" + + # Use the option below to specify your applicable package tree, eg. when using non-LTS Ubuntu versions # # for a list of available Debian distributions, visit http://download.ceph.com/debian-{{ ceph_stable_release }}/dists/ # for more info read: https://github.com/ceph/ceph-ansible/issues/305 @@ -194,6 +199,11 @@ dummy: #ceph_dev_branch: master # development branch you would like to use e.g: master, wip-hack #ceph_dev_sha1: latest # distinct sha1 to use, defaults to 'latest' (as in latest built) +#nfs_ganesha_dev: false # use development repos for nfs-ganesha + +# Set this to choose the version of ceph dev libraries used in the nfs-ganesha packages from shaman +# flavors so far include: ceph_master, ceph_jewel, ceph_kraken, ceph_luminous +#nfs_ganesha_flavor: "ceph_master" # REPOSITORY: CUSTOM @@ -383,13 +393,17 @@ dummy: #handler_health_rgw_check_retries: 5 #handler_health_rgw_check_delay: 10 +############### +# NFS-GANESHA # +############### + # Confiure the type of NFS gatway access. At least one must be enabled for an # NFS role to be useful # # Set this to true to enable File access via NFS. Requires an MDS role. -#nfs_file_gw: true +#nfs_file_gw: false # Set this to true to enable Object access via NFS. Requires an RGW role. -#nfs_obj_gw: false +#nfs_obj_gw: true ################### # CONFIG OVERRIDE # diff --git a/group_vars/nfss.yml.sample b/group_vars/nfss.yml.sample index 011f0cc25..6f98a0c54 100644 --- a/group_vars/nfss.yml.sample +++ b/group_vars/nfss.yml.sample @@ -15,14 +15,20 @@ dummy: #fetch_directory: fetch/ +# Even though NFS nodes should not have the admin key +# at their disposal, some people might want to have it +# distributed on RGW nodes. Setting 'copy_admin_key' to 'true' +# will copy the admin key to the /etc/ceph/ directory +#copy_admin_key: false + ####################### # Access type options # ####################### # These are currently in ceph-common defaults because nfs_obj_gw shared with ceph-rgw # Enable NFS File access -#nfs_file_gw: true +#nfs_file_gw: false # Enable NFS Object access -#nfs_obj_gw: false +#nfs_obj_gw: true ###################### # NFS Ganesha Config # @@ -54,24 +60,6 @@ dummy: #ceph_nfs_rgw_access_key: "QFAMEDSJP5DEKJO0DDXY" #ceph_nfs_rgw_secret_key: "iaSFLDVvDdQt6lkNzHyW4fPLZugBAI1g17LO0+87[MAC[M#C" - -################### -# CONFIG OVERRIDE # -################### - -# Ganesha configuration file override. -# This allows you to specify more configuration options -# using an INI style format. -# The following sections are supported: [global], [mon], [osd], [mds], [rgw] -# -# Example: -# ceph_conf_overrides: -# global: -# foo: 1234 -# bar: 5678 -# -#ganesha_conf_overrides: {} - ########## # DOCKER # ########## diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index 24093b9c0..ee92c71df 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -138,6 +138,11 @@ ceph_repository: rhcs #ceph_stable_release: dummy #ceph_stable_repo: "{{ ceph_mirror }}/debian-{{ ceph_stable_release }}" +#nfs_ganesha_stable: true # use stable repos for nfs-ganesha +#nfs_ganesha_stable_branch: V2.5-stable +#nfs_ganesha_stable_deb_repo: "{{ ceph_mirror }}/nfs-ganesha/deb-{{ nfs_ganesha_stable_branch }}/{{ ceph_stable_release }}" + + # Use the option below to specify your applicable package tree, eg. when using non-LTS Ubuntu versions # # for a list of available Debian distributions, visit http://download.ceph.com/debian-{{ ceph_stable_release }}/dists/ # for more info read: https://github.com/ceph/ceph-ansible/issues/305 @@ -194,6 +199,11 @@ ceph_repository: rhcs #ceph_dev_branch: master # development branch you would like to use e.g: master, wip-hack #ceph_dev_sha1: latest # distinct sha1 to use, defaults to 'latest' (as in latest built) +#nfs_ganesha_dev: false # use development repos for nfs-ganesha + +# Set this to choose the version of ceph dev libraries used in the nfs-ganesha packages from shaman +# flavors so far include: ceph_master, ceph_jewel, ceph_kraken, ceph_luminous +#nfs_ganesha_flavor: "ceph_master" # REPOSITORY: CUSTOM @@ -383,13 +393,17 @@ ceph_repository: rhcs #handler_health_rgw_check_retries: 5 #handler_health_rgw_check_delay: 10 +############### +# NFS-GANESHA # +############### + # Confiure the type of NFS gatway access. At least one must be enabled for an # NFS role to be useful # # Set this to true to enable File access via NFS. Requires an MDS role. -#nfs_file_gw: true +#nfs_file_gw: false # Set this to true to enable Object access via NFS. Requires an RGW role. -#nfs_obj_gw: false +#nfs_obj_gw: true ################### # CONFIG OVERRIDE # diff --git a/roles/ceph-common/tasks/installs/debian_community_repository.yml b/roles/ceph-common/tasks/installs/debian_community_repository.yml index 3996416a4..10e60dc6d 100644 --- a/roles/ceph-common/tasks/installs/debian_community_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_community_repository.yml @@ -10,14 +10,11 @@ state: present changed_when: false -- name: configure debian gluster nfs ganesha community repository for rgw nfs +- name: add nfs-ganesha stable repository apt_repository: - repo: "{{ item }}" + repo: "deb {{ nfs_ganesha_stable_deb_repo }} {{ ceph_stable_distro_source | default(ansible_lsb.codename) }} main" state: present - with_items: - - ppa:gluster/libntirpc - - ppa:gluster/nfs-ganesha changed_when: false when: - - (nfs_obj_gw or nfs_file_gw) - - not ansible_distribution == "Debian" + - nfs_group_name in group_names + - nfs_ganesha_stable diff --git a/roles/ceph-common/tasks/installs/debian_dev_repository.yml b/roles/ceph-common/tasks/installs/debian_dev_repository.yml index e37e2ffe3..b19501e3a 100644 --- a/roles/ceph-common/tasks/installs/debian_dev_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_dev_repository.yml @@ -10,3 +10,24 @@ repo: "{{ ceph_dev_deb_repo.content }}" state: present changed_when: false + +- name: fetch nfs-ganesha development repository + uri: + url: https://shaman.ceph.com/api/repos/nfs-ganesha/next/latest/{{ ansible_distribution | lower }}/{{ ansible_distribution_release }}/flavors/{{ nfs_ganesha_flavor }}/repo + return_content: yes + register: nfs_ganesha_apt_repo + when: + - nfs_group_name in group_names + - nfs_ganesha_dev + +- name: add nfs-ganesha development repository + copy: + content: "{{ nfs_ganesha_dev_apt_repo.content }}" + dest: /etc/apt/sources.list.d/nfs-ganesha-dev.list + owner: root + group: root + backup: yes + when: + - nfs_group_name in group_names + - nfs_ganesha_dev + diff --git a/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml b/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml index 1aa67ea2b..5dd37863c 100644 --- a/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml +++ b/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml @@ -43,10 +43,26 @@ - name: install red hat storage nfs gateway for debian apt: - name: nfs-ganesha-fsal + name: nfs-ganesha state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" when: nfs_group_name in group_names +- name: install red hat storage nfs file gateway + apt: + name: nfs-ganesha-ceph + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + when: + - nfs_group_name in group_names + - nfs_file_gw + +- name: install red hat storage nfs obj gateway + apt: + name: nfs-ganesha-rgw + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + when: + - nfs_group_name in group_names + - nfs_obj_gw + - name: install ceph mgr for debian apt: pkg: ceph-mgr diff --git a/roles/ceph-common/tasks/installs/install_debian_packages.yml b/roles/ceph-common/tasks/installs/install_debian_packages.yml index 9797aaf70..076e839b4 100644 --- a/roles/ceph-common/tasks/installs/install_debian_packages.yml +++ b/roles/ceph-common/tasks/installs/install_debian_packages.yml @@ -44,13 +44,22 @@ when: - nfs_group_name in group_names -- name: install nfs gateway for debian - apt: - name: nfs-ganesha-fsal - state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - update_cache: yes +- name: install nfs cephfs gateway + package: + name: nfs-ganesha-ceph + when: + - nfs_group_name in group_names + - nfs_file_gw + +- name: install nfs rgw gateway + package: + name: "{{ item }}" + with_items: + - nfs-ganesha-rgw + - radosgw when: - nfs_group_name in group_names + - nfs_obj_gw - name: install ceph mgr for debian apt: diff --git a/roles/ceph-common/tasks/installs/install_redhat_packages.yml b/roles/ceph-common/tasks/installs/install_redhat_packages.yml index 51e07c3f1..0688b3db4 100644 --- a/roles/ceph-common/tasks/installs/install_redhat_packages.yml +++ b/roles/ceph-common/tasks/installs/install_redhat_packages.yml @@ -73,28 +73,22 @@ - nfs_group_name in group_names - nfs_file_gw -- name: install redhat nfs-ganesha-rgw and ceph-radosgw packages +- name: install nfs cephfs gateway package: - name: "{{ item }}" - with_items: - - nfs-ganesha-fsal - - ceph-radosgw + name: nfs-ganesha-ceph when: - nfs_group_name in group_names - - nfs_obj_gw - - ceph_rhcs_version == "2" + - nfs_file_gw - name: install redhat nfs-ganesha-rgw and ceph-radosgw packages package: name: "{{ item }}" with_items: - nfs-ganesha-rgw - - nfs-ganesha-ceph - ceph-radosgw when: - nfs_group_name in group_names - nfs_obj_gw - - ceph_rhcs_version == "3" - name: install redhat ceph-mgr package package: diff --git a/roles/ceph-common/tasks/installs/redhat_community_repository.yml b/roles/ceph-common/tasks/installs/redhat_community_repository.yml index 013f8aa7f..2928dc0d0 100644 --- a/roles/ceph-common/tasks/installs/redhat_community_repository.yml +++ b/roles/ceph-common/tasks/installs/redhat_community_repository.yml @@ -12,3 +12,16 @@ state: present gpgkey: "{{ ceph_stable_key }}" baseurl: "{{ ceph_mirror }}/rpm-{{ ceph_stable_release }}/{{ ceph_stable_redhat_distro }}/$basearch" + +- name: add nfs-ganesha stable repository + yum_repository: + name: nfs_ganesha_stable + description: nfs-ganesha stable repo + gpgcheck: yes + state: present + gpgkey: "{{ ceph_stable_key }}" + baseurl: "{{ ceph_mirror }}/nfs-ganesha/rpm-{{ nfs_ganesha_stable_branch }}/{{ ceph_stable_release }}/$basearch" + when: + - nfs_group_name in group_names + - nfs_ganesha_stable + diff --git a/roles/ceph-common/tasks/installs/redhat_dev_repository.yml b/roles/ceph-common/tasks/installs/redhat_dev_repository.yml index 6bc4b065b..989a604ac 100644 --- a/roles/ceph-common/tasks/installs/redhat_dev_repository.yml +++ b/roles/ceph-common/tasks/installs/redhat_dev_repository.yml @@ -12,3 +12,24 @@ owner: root group: root backup: yes + +- name: fetch nfs-ganesha red hat development repository + uri: + url: https://shaman.ceph.com/api/repos/nfs-ganesha/next/latest/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/flavors/{{ nfs_ganesha_flavor }}/repo + return_content: yes + register: nfs_ganesha_dev_yum_repo + when: + - nfs_group_name in group_names + - nfs_ganesha_dev + +- name: add nfs-ganesha development repository + copy: + content: "{{ nfs_ganesha_dev_yum_repo.content }}" + dest: /etc/yum.repos.d/nfs-ganesha-dev.repo + owner: root + group: root + backup: yes + when: + - nfs_group_name in group_names + - nfs_ganesha_dev + diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index e34263380..6d973677b 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -130,6 +130,11 @@ ceph_stable_key: https://download.ceph.com/keys/release.asc ceph_stable_release: dummy ceph_stable_repo: "{{ ceph_mirror }}/debian-{{ ceph_stable_release }}" +nfs_ganesha_stable: true # use stable repos for nfs-ganesha +nfs_ganesha_stable_branch: V2.5-stable +nfs_ganesha_stable_deb_repo: "{{ ceph_mirror }}/nfs-ganesha/deb-{{ nfs_ganesha_stable_branch }}/{{ ceph_stable_release }}" + + # Use the option below to specify your applicable package tree, eg. when using non-LTS Ubuntu versions # # for a list of available Debian distributions, visit http://download.ceph.com/debian-{{ ceph_stable_release }}/dists/ # for more info read: https://github.com/ceph/ceph-ansible/issues/305 @@ -186,6 +191,11 @@ ceph_rhcs_repository_path: "{{ ceph_stable_rh_storage_repository_path | default( ceph_dev_branch: master # development branch you would like to use e.g: master, wip-hack ceph_dev_sha1: latest # distinct sha1 to use, defaults to 'latest' (as in latest built) +nfs_ganesha_dev: false # use development repos for nfs-ganesha + +# Set this to choose the version of ceph dev libraries used in the nfs-ganesha packages from shaman +# flavors so far include: ceph_master, ceph_jewel, ceph_kraken, ceph_luminous +nfs_ganesha_flavor: "ceph_master" # REPOSITORY: CUSTOM @@ -375,13 +385,17 @@ handler_health_mds_check_delay: 10 handler_health_rgw_check_retries: 5 handler_health_rgw_check_delay: 10 +############### +# NFS-GANESHA # +############### + # Confiure the type of NFS gatway access. At least one must be enabled for an # NFS role to be useful # # Set this to true to enable File access via NFS. Requires an MDS role. -nfs_file_gw: true +nfs_file_gw: false # Set this to true to enable Object access via NFS. Requires an RGW role. -nfs_obj_gw: false +nfs_obj_gw: true ################### # CONFIG OVERRIDE # diff --git a/roles/ceph-nfs/defaults/main.yml b/roles/ceph-nfs/defaults/main.yml index f31463d5d..831deb52a 100644 --- a/roles/ceph-nfs/defaults/main.yml +++ b/roles/ceph-nfs/defaults/main.yml @@ -7,14 +7,20 @@ fetch_directory: fetch/ +# Even though NFS nodes should not have the admin key +# at their disposal, some people might want to have it +# distributed on RGW nodes. Setting 'copy_admin_key' to 'true' +# will copy the admin key to the /etc/ceph/ directory +copy_admin_key: yes + ####################### # Access type options # ####################### # These are currently in ceph-common defaults because nfs_obj_gw shared with ceph-rgw # Enable NFS File access -#nfs_file_gw: true +nfs_file_gw: false # Enable NFS Object access -#nfs_obj_gw: false +nfs_obj_gw: true ###################### # NFS Ganesha Config # @@ -47,23 +53,6 @@ ceph_nfs_rgw_user: "cephnfs" #ceph_nfs_rgw_secret_key: "iaSFLDVvDdQt6lkNzHyW4fPLZugBAI1g17LO0+87[MAC[M#C" -################### -# CONFIG OVERRIDE # -################### - -# Ganesha configuration file override. -# This allows you to specify more configuration options -# using an INI style format. -# The following sections are supported: [global], [mon], [osd], [mds], [rgw] -# -# Example: -# ceph_conf_overrides: -# global: -# foo: 1234 -# bar: 5678 -# -ganesha_conf_overrides: {} - ########## # DOCKER # ########## diff --git a/roles/ceph-nfs/tasks/pre_requisite.yml b/roles/ceph-nfs/tasks/pre_requisite.yml index ad19b4be3..8b8722b48 100644 --- a/roles/ceph-nfs/tasks/pre_requisite.yml +++ b/roles/ceph-nfs/tasks/pre_requisite.yml @@ -1,29 +1,36 @@ --- -- name: create nfs gateway directories - file: - path: "{{ item }}" - state: directory - owner: "ceph" - group: "ceph" - mode: "0755" - with_items: - - /var/lib/nfs/ganesha - - /var/run/ganesha - - name: create rgw nfs user command: radosgw-admin --cluster {{ cluster }} user create --uid={{ ceph_nfs_rgw_user }} --display-name="RGW NFS User" register: rgwuser + delegate_to: "{{ groups[mon_group_name][0] }}" when: nfs_obj_gw - name: set access key set_fact: ceph_nfs_rgw_access_key: "{{ (rgwuser.stdout | from_json)['keys'][0]['access_key'] }}" - when: nfs_obj_gw + delegate_to: "{{ groups[mon_group_name][0] }}" + when: + - nfs_obj_gw + - ceph_nfs_rgw_access_key is not defined - name: set secret key set_fact: ceph_nfs_rgw_secret_key: "{{(rgwuser.stdout | from_json)['keys'][0]['secret_key']}}" - when: nfs_obj_gw + delegate_to: "{{ groups[mon_group_name][0] }}" + when: + - nfs_obj_gw + - ceph_nfs_rgw_secret_key is not defined + +- name: create nfs gateway directories + file: + path: "{{ item }}" + state: directory + owner: "ceph" + group: "ceph" + mode: "0755" + with_items: + - /var/lib/nfs/ganesha + - /var/run/ganesha - name: generate ganesha configuration file action: config_template @@ -33,7 +40,6 @@ owner: "root" group: "root" mode: "0644" - config_overrides: "{{ ganesha_conf_overrides }}" config_type: ini - name: start nfs gateway service -- 2.39.5