From 849786967ac4c6235e624243019f0b54bf3340a4 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Thu, 12 Oct 2017 14:55:20 +0100 Subject: [PATCH] ceph-common: Add initial support for openSUSE Leap distributions openSUSE Leap 42.3 provides support for Ceph Luminous in both the distribution package and the latest available version in the OBS repository so add these as the only available installation methods for openSUSE. Signed-off-by: Markos Chandras --- group_vars/all.yml.sample | 20 ++++++- group_vars/rhcs.yml.sample | 20 ++++++- roles/ceph-common/meta/main.yml | 3 ++ .../tasks/checks/check_mandatory_vars.yml | 4 +- .../ceph-common/tasks/checks/check_system.yml | 9 +++- .../tasks/configure_cluster_name.yml | 2 +- ...configure_suse_repository_installation.yml | 5 ++ .../tasks/installs/install_on_suse.yml | 24 +++++++++ .../tasks/installs/install_suse_packages.yml | 54 +++++++++++++++++++ .../tasks/installs/suse_obs_repository.yml | 8 +++ roles/ceph-common/tasks/main.yml | 23 ++++++-- .../misc/{ntp_redhat.yml => ntp_rpm.yml} | 2 +- roles/ceph-defaults/defaults/main.yml | 18 ++++++- site.yml.sample | 6 +++ 14 files changed, 185 insertions(+), 13 deletions(-) create mode 100644 roles/ceph-common/tasks/installs/configure_suse_repository_installation.yml create mode 100644 roles/ceph-common/tasks/installs/install_on_suse.yml create mode 100644 roles/ceph-common/tasks/installs/install_suse_packages.yml create mode 100644 roles/ceph-common/tasks/installs/suse_obs_repository.yml rename roles/ceph-common/tasks/misc/{ntp_redhat.yml => ntp_rpm.yml} (82%) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 2a75fa6bb..6b42ea21a 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -80,6 +80,12 @@ dummy: # - hdparm # - python-setuptools +#suse_package_dependencies: +# - python-pycurl +# - python-xml +# - hdparm +# - python-setuptools + # Whether or not to install the ceph-test package. #ceph_test: false @@ -116,7 +122,7 @@ dummy: # ORIGIN SOURCE # # Choose between: -# - 'repository' means that you will get ceph installed through a new repository. Later below choose between 'community', 'rhcs' or 'dev' +# - 'repository' means that you will get ceph installed through a new repository. Later below choose between 'community', 'rhcs', 'dev' or 'obs' # - 'distro' means that no separate repo file will be added # you will get whatever version of Ceph is included in your Linux distro. # 'local' means that the ceph binaries will be copied over from the local machine @@ -134,6 +140,7 @@ dummy: # - dev # - uca # - custom +# - obs # REPOSITORY: COMMUNITY VERSION @@ -201,6 +208,15 @@ dummy: #ceph_stable_openstack_release_uca: liberty #ceph_stable_release_uca: "{{ansible_lsb.codename}}-updates/{{ceph_stable_openstack_release_uca}}" +# REPOSITORY: openSUSE OBS +# +# Enabled when ceph_repository == 'obs' +# +# This allows the install of Ceph from the openSUSE OBS repository. The OBS repository +# usually has newer Ceph releases than the normal distro repository. +# +# +#ceph_obs_repo: "https://download.opensuse.org/repositories/filesystems:/ceph:/luminous/openSUSE_Leap_{{ ansible_distribution_version }}/" # REPOSITORY: DEV # @@ -497,9 +513,9 @@ dummy: # do not ever change this here #rolling_update: false - ##################### # Docker pull retry # ##################### #docker_pull_retry: 3 #docker_pull_timeout: "300s" + diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index f95d195b2..76de30f30 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -80,6 +80,12 @@ fetch_directory: ~/ceph-ansible-keys # - hdparm # - python-setuptools +#suse_package_dependencies: +# - python-pycurl +# - python-xml +# - hdparm +# - python-setuptools + # Whether or not to install the ceph-test package. #ceph_test: false @@ -116,7 +122,7 @@ fetch_directory: ~/ceph-ansible-keys # ORIGIN SOURCE # # Choose between: -# - 'repository' means that you will get ceph installed through a new repository. Later below choose between 'community', 'rhcs' or 'dev' +# - 'repository' means that you will get ceph installed through a new repository. Later below choose between 'community', 'rhcs', 'dev' or 'obs' # - 'distro' means that no separate repo file will be added # you will get whatever version of Ceph is included in your Linux distro. # 'local' means that the ceph binaries will be copied over from the local machine @@ -134,6 +140,7 @@ ceph_repository: rhcs # - dev # - uca # - custom +# - obs # REPOSITORY: COMMUNITY VERSION @@ -201,6 +208,15 @@ ceph_repository: rhcs #ceph_stable_openstack_release_uca: liberty #ceph_stable_release_uca: "{{ansible_lsb.codename}}-updates/{{ceph_stable_openstack_release_uca}}" +# REPOSITORY: openSUSE OBS +# +# Enabled when ceph_repository == 'obs' +# +# This allows the install of Ceph from the openSUSE OBS repository. The OBS repository +# usually has newer Ceph releases than the normal distro repository. +# +# +#ceph_obs_repo: "https://download.opensuse.org/repositories/filesystems:/ceph:/luminous/openSUSE_Leap_{{ ansible_distribution_version }}/" # REPOSITORY: DEV # @@ -497,9 +513,9 @@ ceph_repository: rhcs # do not ever change this here #rolling_update: false - ##################### # Docker pull retry # ##################### #docker_pull_retry: 3 #docker_pull_timeout: "300s" + diff --git a/roles/ceph-common/meta/main.yml b/roles/ceph-common/meta/main.yml index 66e2d4b47..50c0ab699 100644 --- a/roles/ceph-common/meta/main.yml +++ b/roles/ceph-common/meta/main.yml @@ -11,6 +11,9 @@ galaxy_info: - name: EL versions: - 7 + - name: opensuse + versions: + - 42.3 categories: - system dependencies: [] diff --git a/roles/ceph-common/tasks/checks/check_mandatory_vars.yml b/roles/ceph-common/tasks/checks/check_mandatory_vars.yml index 239e6c1c9..b4ca5b240 100644 --- a/roles/ceph-common/tasks/checks/check_mandatory_vars.yml +++ b/roles/ceph-common/tasks/checks/check_mandatory_vars.yml @@ -28,7 +28,7 @@ msg: "make sure ceph_stable_release ( {{ ceph_stable_release }} ) is set to a release name (e.g: luminous), http://docs.ceph.com/docs/master/release-notes/" when: - ceph_stable_release == 'dummy' - - ceph_repository not in ['rhcs', 'dev'] + - ceph_repository not in ['rhcs', 'dev', 'obs'] tags: - package-install @@ -38,7 +38,7 @@ when: - ceph_stable_release not in ceph_release_num - ceph_origin == 'repository' - - ceph_repository not in ['rhcs', 'dev'] + - ceph_repository not in ['rhcs', 'dev', 'obs'] tags: - package-install diff --git a/roles/ceph-common/tasks/checks/check_system.yml b/roles/ceph-common/tasks/checks/check_system.yml index 06055f795..1e082050c 100644 --- a/roles/ceph-common/tasks/checks/check_system.yml +++ b/roles/ceph-common/tasks/checks/check_system.yml @@ -15,7 +15,7 @@ fail: msg: "Distribution not supported {{ ansible_os_family }}" when: - - ansible_os_family not in ['Debian', 'RedHat', 'ClearLinux'] + - ansible_os_family not in ['Debian', 'RedHat', 'ClearLinux', 'Suse'] - name: fail on unsupported distribution for red hat ceph storage fail: @@ -52,6 +52,13 @@ - ceph_repository == 'uca' - ansible_distribution != 'Ubuntu' +- name: fail on unsupported openSUSE distribution + fail: + msg: "Distribution not supported: {{ ansible_distribution }}" + when: + - ansible_distribution == 'openSUSE Leap' + - ansible_distribution_version | version_compare('42.3', '<') + - name: fail on unsupported ansible version fail: msg: "Ansible version must be >= 2.3.x, please update!" diff --git a/roles/ceph-common/tasks/configure_cluster_name.yml b/roles/ceph-common/tasks/configure_cluster_name.yml index 1c6dd3c78..d516c27f5 100644 --- a/roles/ceph-common/tasks/configure_cluster_name.yml +++ b/roles/ceph-common/tasks/configure_cluster_name.yml @@ -7,7 +7,7 @@ line: "CLUSTER={{ cluster }}" regexp: "^CLUSTER=" when: - - ansible_os_family == "RedHat" + - ansible_os_family in ["RedHat", "Suse"] # NOTE(leseb): we are performing the following check # to ensure any Jewel installation will not fail. diff --git a/roles/ceph-common/tasks/installs/configure_suse_repository_installation.yml b/roles/ceph-common/tasks/installs/configure_suse_repository_installation.yml new file mode 100644 index 000000000..15665aa90 --- /dev/null +++ b/roles/ceph-common/tasks/installs/configure_suse_repository_installation.yml @@ -0,0 +1,5 @@ +--- +- name: include suse_obs_repository.yml + include: suse_obs_repository.yml + when: + - ceph_repository == 'obs' diff --git a/roles/ceph-common/tasks/installs/install_on_suse.yml b/roles/ceph-common/tasks/installs/install_on_suse.yml new file mode 100644 index 000000000..57b4a2ef2 --- /dev/null +++ b/roles/ceph-common/tasks/installs/install_on_suse.yml @@ -0,0 +1,24 @@ +--- +# SUSE only supports the following: +# - ceph_origin == 'distro' +# - ceph_origin == 'repository' and ceph_repository == 'obs' +- name: Check for supported installation method on suse + fail: + msg: "Unsupported installation method origin:{{ ceph_origin }} repo:{{ ceph_repository }}'" + when: + - ceph_origin != 'distro' or (ceph_origin == 'repository' and ceph_repository != 'obs') + +- name: include configure_suse_repository_installation.yml + include: configure_suse_repository_installation.yml + when: + - ceph_origin == 'repository' + +- name: install dependencies + zypper: + name: "{{ item }}" + state: present + update_cache: yes + with_items: "{{ suse_package_dependencies }}" + +- name: include install_suse_packages.yml + include: install_suse_packages.yml diff --git a/roles/ceph-common/tasks/installs/install_suse_packages.yml b/roles/ceph-common/tasks/installs/install_suse_packages.yml new file mode 100644 index 000000000..db5218639 --- /dev/null +++ b/roles/ceph-common/tasks/installs/install_suse_packages.yml @@ -0,0 +1,54 @@ +--- +- name: install suse dependencies + package: + name: "{{ suse_package_dependencies }}" + state: present + when: + - ansible_distribution == 'Suse' + +- name: install suse ceph-common + package: + name: "ceph-common" + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + +- name: install suse ceph-mon package + package: + name: "ceph-mon" + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + when: + - mon_group_name in group_names + +- name: install suse ceph-osd package + package: + name: "ceph-osd" + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + when: + - osd_group_name in group_names + +- name: install suse ceph-fuse package + package: + name: "ceph-fuse" + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + when: + - client_group_name in group_names + +- name: install suse ceph-base package + package: + name: "ceph-base" + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + when: + - client_group_name in group_names + +- name: install suse ceph-test package + package: + name: ceph-test + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + when: + - ceph_test + +- name: install suse ceph-radosgw package + package: + name: ceph-radosgw + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + when: + - rgw_group_name in group_names diff --git a/roles/ceph-common/tasks/installs/suse_obs_repository.yml b/roles/ceph-common/tasks/installs/suse_obs_repository.yml new file mode 100644 index 000000000..4f13a40f0 --- /dev/null +++ b/roles/ceph-common/tasks/installs/suse_obs_repository.yml @@ -0,0 +1,8 @@ +--- +- name: configure openSUSE ceph OBS repository + zypper_repository: + name: "OBS:filesystems:ceph" + state: present + uri: "{{ ceph_obs_repo }}" + auto_import_keys: yes + autorefresh: yes diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index 314f4aa76..5aee03eb0 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -28,6 +28,15 @@ # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False +- name: include installs/install_on_suse.yml + include: installs/install_on_suse.yml + when: + - ansible_os_family == 'Suse' + tags: + - package-install + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False + - name: include installs/install_on_debian.yml include: installs/install_on_debian.yml when: @@ -46,10 +55,18 @@ # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- name: include ntp setup tasks - include: "misc/ntp_{{ ansible_os_family | lower }}.yml" +- name: include ntp debian setup tasks + include: "misc/ntp_debian.yml" when: - - ansible_os_family in ['RedHat', 'Debian'] + - ansible_os_family == 'Debian' + - ntp_service_enabled + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False + +- name: include ntp rpm setup tasks + include: "misc/ntp_rpm.yml" + when: + - ansible_os_family in ['RedHat', 'Suse'] - ntp_service_enabled # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False diff --git a/roles/ceph-common/tasks/misc/ntp_redhat.yml b/roles/ceph-common/tasks/misc/ntp_rpm.yml similarity index 82% rename from roles/ceph-common/tasks/misc/ntp_redhat.yml rename to roles/ceph-common/tasks/misc/ntp_rpm.yml index 7e3481508..91d2d7d8a 100644 --- a/roles/ceph-common/tasks/misc/ntp_redhat.yml +++ b/roles/ceph-common/tasks/misc/ntp_rpm.yml @@ -1,5 +1,5 @@ --- -- name: install ntp on redhat +- name: install ntp package: name: ntp state: present diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 0721f5bb5..ec2fcae0b 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -72,6 +72,12 @@ redhat_package_dependencies: - hdparm - python-setuptools +suse_package_dependencies: + - python-pycurl + - python-xml + - hdparm + - python-setuptools + # Whether or not to install the ceph-test package. ceph_test: false @@ -108,7 +114,7 @@ ceph_custom: False # backward compatibility with stable-2.2, will disappear in s # ORIGIN SOURCE # # Choose between: -# - 'repository' means that you will get ceph installed through a new repository. Later below choose between 'community', 'rhcs' or 'dev' +# - 'repository' means that you will get ceph installed through a new repository. Later below choose between 'community', 'rhcs', 'dev' or 'obs' # - 'distro' means that no separate repo file will be added # you will get whatever version of Ceph is included in your Linux distro. # 'local' means that the ceph binaries will be copied over from the local machine @@ -126,6 +132,7 @@ valid_ceph_repository: - dev - uca - custom + - obs # REPOSITORY: COMMUNITY VERSION @@ -193,6 +200,15 @@ ceph_rhcs_cdn_debian_repo_version: "/3-release/" # for GA, later for updates use #ceph_stable_openstack_release_uca: liberty #ceph_stable_release_uca: "{{ansible_lsb.codename}}-updates/{{ceph_stable_openstack_release_uca}}" +# REPOSITORY: openSUSE OBS +# +# Enabled when ceph_repository == 'obs' +# +# This allows the install of Ceph from the openSUSE OBS repository. The OBS repository +# usually has newer Ceph releases than the normal distro repository. +# +# +#ceph_obs_repo: "https://download.opensuse.org/repositories/filesystems:/ceph:/luminous/openSUSE_Leap_{{ ansible_distribution_version }}/" # REPOSITORY: DEV # diff --git a/site.yml.sample b/site.yml.sample index 1585a6e88..f771ade09 100644 --- a/site.yml.sample +++ b/site.yml.sample @@ -43,6 +43,12 @@ when: - systempython2.stat.exists is undefined or systempython2.stat.exists == false + - name: install python2 for opensuse + raw: sudo zypper -n install python-base creates=/usr/bin/python2.7 + ignore_errors: yes + when: + - systempython2.stat.exists is undefined or systempython2.stat.exists == false + - name: gather facts setup: when: