From 7e284920d190b6ae4a58c6def283bc35c6861e9b Mon Sep 17 00:00:00 2001 From: James Saint-Rossy Date: Wed, 24 Aug 2016 00:23:47 -0400 Subject: [PATCH 1/8] Fixes for Hammer install and added numerical release checks --- roles/ceph-common/defaults/main.yml | 9 +++++++ .../tasks/installs/install_on_redhat.yml | 14 +++++------ roles/ceph-common/tasks/main.yml | 24 +++++++++++++++++++ roles/ceph-mon/tasks/start_monitor.yml | 20 ++++++++++++---- 4 files changed, 56 insertions(+), 11 deletions(-) diff --git a/roles/ceph-common/defaults/main.yml b/roles/ceph-common/defaults/main.yml index 3e4cc259e..f546538a1 100644 --- a/roles/ceph-common/defaults/main.yml +++ b/roles/ceph-common/defaults/main.yml @@ -115,6 +115,15 @@ ceph_stable_releases: - hammer - infernalis +ceph_release_num: + dumpling: 0.67 + emperor: 0.72 + firefly: 0.80 + giant: 0.87 + hammer: 0.94 + infernalis: 9 + jewel: 10 + # 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 diff --git a/roles/ceph-common/tasks/installs/install_on_redhat.yml b/roles/ceph-common/tasks/installs/install_on_redhat.yml index b3561fdbc..91f40e679 100644 --- a/roles/ceph-common/tasks/installs/install_on_redhat.yml +++ b/roles/ceph-common/tasks/installs/install_on_redhat.yml @@ -3,7 +3,7 @@ yum: name: "{{ item }}" state: present - with_items: redhat_package_dependencies + with_items: "{{ redhat_package_dependencies }}" when: - ansible_distribution == "RedHat" - ansible_pkg_mgr == "yum" @@ -12,7 +12,7 @@ dnf: name: "{{ item }}" state: present - with_items: redhat_package_dependencies + with_items: "{{ redhat_package_dependencies }}" when: - ansible_distribution == "RedHat" - ansible_pkg_mgr == "dnf" @@ -21,7 +21,7 @@ yum: name: "{{ item }}" state: present - with_items: centos_package_dependencies + with_items: "{{ centos_package_dependencies }}" when: - ansible_distribution == "CentOS" - ansible_pkg_mgr == "yum" @@ -30,7 +30,7 @@ dnf: name: "{{ item }}" state: present - with_items: centos_package_dependencies + with_items: "{{ centos_package_dependencies }}" when: - ansible_distribution == "CentOS" - ansible_pkg_mgr == "dnf" @@ -58,7 +58,7 @@ copy: src: "{{ansible_dir}}/rundep" dest: "{{ item }}" - with_items: rundep_location.stdout_lines + with_items: "{{ rundep_location }}.stdout_lines" when: - ceph_origin == 'local' - use_installer @@ -66,7 +66,7 @@ - name: install ceph dependencies script: "{{ ansible_dir }}/rundep_installer.sh {{ item }}" become: true - with_items: rundep_location.stdout_lines + with_items: "{{ rundep_location }}.stdout_lines" when: - ceph_origin == 'local' - use_installer @@ -76,7 +76,7 @@ name: ceph state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" when: - - not use_server_package_split + - ceph_release_num.{{ ceph_stable_release}} <= ceph_release_num.infernalis - ansible_pkg_mgr == "yum" - ceph_origin != 'local' diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index 54edb2256..7ae1ac9e3 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -5,9 +5,13 @@ - include: ./checks/check_firewall.yml when: check_firewall + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./misc/system_tuning.yml when: osd_group_name in group_names + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./pre_requisites/prerequisite_rh_storage_iso_install.yml when: @@ -15,6 +19,8 @@ - ceph_rhcs_iso_install tags: - package-install + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./pre_requisites/prerequisite_rh_storage_cdn_install.yml when: @@ -23,6 +29,8 @@ - ansible_os_family == "RedHat" tags: - package-install + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./installs/install_on_redhat.yml when: @@ -30,6 +38,8 @@ not ceph_rhcs_iso_install tags: - package-install + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./installs/install_rh_storage_on_redhat.yml when: @@ -37,6 +47,8 @@ - ceph_rhcs tags: - package-install + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./installs/install_on_debian.yml when: @@ -44,6 +56,8 @@ - not ceph_rhcs tags: - package-install + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./installs/install_rh_storage_on_debian.yml when: @@ -51,6 +65,8 @@ - ceph_rhcs tags: - package-install + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./installs/install_rgw_on_redhat.yml when: @@ -59,6 +75,8 @@ - rgw_group_name in group_names tags: - package-install + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./installs/install_rgw_on_debian.yml when: @@ -67,16 +85,22 @@ - rgw_group_name in group_names tags: - package-install + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./misc/ntp_redhat.yml when: - ansible_os_family == 'RedHat' - ntp_service_enabled + # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) + static: False - include: ./misc/ntp_debian.yml when: - 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 - include: facts.yml diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index 846c77392..641461662 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -20,14 +20,26 @@ when: - not use_systemd -# NOTE (leseb): somehow the service ansible module is messing things up -# as a safety measure we run the raw command +# legacy ceph system v init scripts require a mon section in order to work +- name: add mon section into ceph.conf for systemv init scripts + ini_file: + dest: /etc/ceph/ceph.conf + section: mon.{{ ansible_host }} + option: host + value: "{{ ansible_host }}" + state: present + when: + - ansible_os_family == "RedHat" + - ceph_release_num.{{ ceph_stable_release }} < ceph_release_num.infernalis + +# NOTE (jsaintrocc): can't use service module because we need to use the +# legacy systemv init for older ceph releases. Even when the os supports systemd - name: start and add that the monitor service to the init sequence command: service ceph start mon changed_when: false when: - - ansible_distribution != "Ubuntu" - - is_before_infernalis + - ansible_os_family == "RedHat" + - ceph_release_num.{{ ceph_stable_release }} < ceph_release_num.infernalis - name: start and add that the monitor service to the init sequence (for or after infernalis) command: systemctl enable ceph-mon@{{ monitor_name }} From ab93cd0858dab73cba0d902b2fd3d2bc59695383 Mon Sep 17 00:00:00 2001 From: James Saint-Rossy Date: Wed, 24 Aug 2016 00:38:52 -0400 Subject: [PATCH 2/8] Remove unused use_server_package_split boolean --- README.md | 2 -- group_vars/all.sample | 4 ---- roles/ceph-common/defaults/main.yml | 4 ---- 3 files changed, 10 deletions(-) diff --git a/README.md b/README.md index b55063d26..ce1c4d386 100644 --- a/README.md +++ b/README.md @@ -179,8 +179,6 @@ information about how to generate appropriate values for these variables. By default, ceph-common installs from Ceph repository. However, you can set `ceph_origin` to "distro" to install Ceph from your default repository. -Moreover for people looking to install any version of Ceph prior to the Jewel release on a Red Hat based system you would have to set `use_server_package_split: false`. - ## Setup for Vagrant using libvirt provider * Create vagrant_variables.yml diff --git a/group_vars/all.sample b/group_vars/all.sample index c585b840a..7bdc5f235 100644 --- a/group_vars/all.sample +++ b/group_vars/all.sample @@ -40,10 +40,6 @@ dummy: # "state=latest". #upgrade_ceph_packages: False -# If this is false then the 'ceph' package will be installed on rpm systems, which -# is not needed for versions after infernalis. -#use_server_package_split: true - # /!\ EITHER ACTIVE ceph_stable OR ceph_stable_uca OR ceph_dev OR ceph_custom /!\ #debian_package_dependencies: diff --git a/roles/ceph-common/defaults/main.yml b/roles/ceph-common/defaults/main.yml index f546538a1..9cf584407 100644 --- a/roles/ceph-common/defaults/main.yml +++ b/roles/ceph-common/defaults/main.yml @@ -32,10 +32,6 @@ check_firewall: False # "state=latest". upgrade_ceph_packages: False -# If this is false then the 'ceph' package will be installed on rpm systems, which -# is not needed for versions after infernalis. -use_server_package_split: true - # /!\ EITHER ACTIVE ceph_stable OR ceph_stable_uca OR ceph_dev OR ceph_custom /!\ debian_package_dependencies: From f52be237708118e2c45bad9546110649401ea48d Mon Sep 17 00:00:00 2001 From: James Saint-Rossy Date: Fri, 2 Sep 2016 19:31:59 -0400 Subject: [PATCH 3/8] Prevent local_action from requiring root --- infrastructure-playbooks/purge-cluster.yml | 2 ++ roles/ceph-mon/tasks/start_monitor.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index d5e001013..ab3eea6e8 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -86,6 +86,7 @@ ignore_errors: true - name: wait for server to boot + become: false local_action: wait_for port=22 host={{ inventory_hostname }} state=started delay=10 timeout=400 - name: remove data @@ -310,6 +311,7 @@ - name: is reboot needed local_action: shell echo requesting reboot + become: false notify: - restart machine - wait for server to boot diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index 641461662..1842802c9 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -23,7 +23,7 @@ # legacy ceph system v init scripts require a mon section in order to work - name: add mon section into ceph.conf for systemv init scripts ini_file: - dest: /etc/ceph/ceph.conf + dest: /etc/ceph/{{ cluster }}.conf section: mon.{{ ansible_host }} option: host value: "{{ ansible_host }}" From 666637f7155fb5f5644b293c4128a400ca20a848 Mon Sep 17 00:00:00 2001 From: James Saint-Rossy Date: Fri, 9 Sep 2016 17:34:26 -0400 Subject: [PATCH 4/8] Replaced is_before is_after is_ booleans with numerical version dictionary --- group_vars/all.sample | 11 ----- infrastructure-playbooks/purge-cluster.yml | 2 +- roles/ceph-common/defaults/main.yml | 15 ++----- roles/ceph-common/handlers/main.yml | 18 ++++---- roles/ceph-common/tasks/facts.yml | 42 ------------------- .../tasks/installs/install_on_redhat.yml | 26 ++++-------- roles/ceph-common/tasks/main.yml | 27 ++++++------ roles/ceph-mds/tasks/pre_requisite.yml | 6 +-- roles/ceph-mon/tasks/deploy_monitors.yml | 8 ++-- roles/ceph-mon/tasks/start_monitor.yml | 4 +- roles/ceph-osd/tasks/activate_osds.yml | 10 ++--- .../tasks/start_rbd_mirror.yml | 6 +-- roles/ceph-rgw/tasks/main.yml | 2 +- roles/ceph-rgw/tasks/pre_requisite.yml | 2 +- roles/ceph-rgw/tasks/start_radosgw.yml | 6 +-- 15 files changed, 60 insertions(+), 125 deletions(-) diff --git a/group_vars/all.sample b/group_vars/all.sample index 6da490e0d..0c4ed4ae2 100644 --- a/group_vars/all.sample +++ b/group_vars/all.sample @@ -109,17 +109,6 @@ dummy: #ceph_stable_release: jewel # ceph stable release #ceph_stable_repo: "http://download.ceph.com/debian-{{ ceph_stable_release }}" -################### -# Stable Releases # -################### -#ceph_stable_releases: -# - dumpling -# - emperor -# - firefly -# - giant -# - hammer -# - infernalis - # 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 diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index ab3eea6e8..4c8417c13 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -87,7 +87,7 @@ - name: wait for server to boot become: false - local_action: wait_for port=22 host={{ inventory_hostname }} state=started delay=10 timeout=400 + local_action: wait_for port=22 host={{ inventory_hostname }} state=started delay=10 timeout=500 - name: remove data file: diff --git a/roles/ceph-common/defaults/main.yml b/roles/ceph-common/defaults/main.yml index 9ed961204..43276d767 100644 --- a/roles/ceph-common/defaults/main.yml +++ b/roles/ceph-common/defaults/main.yml @@ -101,17 +101,9 @@ ceph_stable_key: https://download.ceph.com/keys/release.asc ceph_stable_release: jewel # ceph stable release ceph_stable_repo: "http://download.ceph.com/debian-{{ ceph_stable_release }}" -################### -# Stable Releases # -################### -ceph_stable_releases: - - dumpling - - emperor - - firefly - - giant - - hammer - - infernalis - +###################################### +# Releases name to number dictionary # +###################################### ceph_release_num: dumpling: 0.67 emperor: 0.72 @@ -120,6 +112,7 @@ ceph_release_num: hammer: 0.94 infernalis: 9 jewel: 10 + kraken: 11 # 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/ diff --git a/roles/ceph-common/handlers/main.yml b/roles/ceph-common/handlers/main.yml index a05397f71..9a547d1a6 100644 --- a/roles/ceph-common/handlers/main.yml +++ b/roles/ceph-common/handlers/main.yml @@ -9,7 +9,7 @@ - socket.rc == 0 - ansible_distribution != 'Ubuntu' - mon_group_name in group_names - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: restart ceph mons with systemd service: @@ -19,7 +19,7 @@ - socket.rc == 0 - use_systemd - mon_group_name in group_names - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: restart ceph mons on ubuntu command: initctl restart ceph-mon cluster={{ cluster }} id={{ monitor_name }} @@ -35,7 +35,7 @@ - socket.rc == 0 - ansible_distribution != 'Ubuntu' - osd_group_name in group_names - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis # This does not just restart OSDs but everything else too. Unfortunately # at this time the ansible role does not have an OSD id list to use @@ -48,7 +48,7 @@ - socket.rc == 0 - use_systemd - osd_group_name in group_names - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: restart ceph osds on ubuntu shell: | @@ -76,7 +76,7 @@ - ansible_distribution != 'Ubuntu' - use_systemd - mds_group_name in group_names - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: restart ceph mdss with systemd service: @@ -86,7 +86,7 @@ - socket.rc == 0 - use_systemd - mds_group_name in group_names - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: restart ceph rgws on ubuntu command: initctl restart radosgw cluster={{ cluster }} id=rgw.{{ ansible_hostname }} @@ -102,7 +102,7 @@ - socketrgw.rc == 0 - ansible_distribution != 'Ubuntu' - rgw_group_name in group_names - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: restart ceph rgws on red hat command: /etc/init.d/ceph-radosgw restart @@ -110,7 +110,7 @@ - socketrgw.rc == 0 - ansible_os_family == 'RedHat' - rgw_group_name in group_names - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: restart ceph rgws with systemd service: @@ -120,7 +120,7 @@ - socketrgw.rc == 0 - use_systemd - rgw_group_name in group_names - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: restart apache2 service: diff --git a/roles/ceph-common/tasks/facts.yml b/roles/ceph-common/tasks/facts.yml index 3a2f7e10c..4491f6874 100644 --- a/roles/ceph-common/tasks/facts.yml +++ b/roles/ceph-common/tasks/facts.yml @@ -21,48 +21,6 @@ - set_fact: use_systemd={{ init_system.strip() == 'systemd' }} -# NOTE (leseb/jsaintrocc): You are supposed to quote variables -# that follow colons to avoid confusion with dicts but this -# causes issues with the boolean, so we keep this syntax styling... -# is_before facts -- set_fact: - is_before_hammer={{ ceph_version | version_compare('0.94.0', '<') }} - -- set_fact: - is_before_infernalis={{ ceph_version | version_compare('9.0.0', '<') }} - -- set_fact: - is_before_jewel={{ ceph_version | version_compare('10.0.0', '<') }} - -- set_fact: - is_before_kraken={{ ceph_version | version_compare('11.0.0', '<') }} - -# is_after facts -- set_fact: - is_after_hammer={{ ceph_version | version_compare('0.95.0', '>') }} - -- set_fact: - is_after_infernalis={{ ceph_version | version_compare('9.4.0', '>') }} - -- set_fact: - is_after_jewel={{ ceph_version | version_compare('10.4.0', '>') }} - -- set_fact: - is_after_kraken={{ ceph_version | version_compare('11.4.0', '>') }} - -# is_version facts -- set_fact: - is_hammer={{ ceph_version | version_compare('0.94.0', '>=') | version_compare('9.0.0', '<') }} - -- set_fact: - is_infernalis={{ ceph_version | version_compare('9.0.0', '>=') and ceph_version | version_compare('10.0.0', '<') }} - -- set_fact: - is_jewel={{ ceph_version | version_compare('10.0.0', '>=') and ceph_version | version_compare('11.0.0', '<') }} - -- set_fact: - is_kraken={{ ceph_version | version_compare('11.0.0', '>=') and ceph_version | version_compare('12.0.0', '<') }} - - set_fact: mds_name: "{{ ansible_hostname }}" when: not mds_use_fqdn diff --git a/roles/ceph-common/tasks/installs/install_on_redhat.yml b/roles/ceph-common/tasks/installs/install_on_redhat.yml index 91f40e679..3e5826091 100644 --- a/roles/ceph-common/tasks/installs/install_on_redhat.yml +++ b/roles/ceph-common/tasks/installs/install_on_redhat.yml @@ -76,7 +76,7 @@ name: ceph state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" when: - - ceph_release_num.{{ ceph_stable_release}} <= ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release}} <= ceph_release_num.infernalis - ansible_pkg_mgr == "yum" - ceph_origin != 'local' @@ -106,8 +106,7 @@ when: - mon_group_name in group_names - ansible_pkg_mgr == "yum" - - (ceph_stable and ceph_stable_release not in ceph_stable_releases) - or ceph_dev + - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_custom @@ -118,9 +117,8 @@ when: - mon_group_name in group_names - ansible_pkg_mgr == "dnf" - - (ceph_stable and ceph_stable_release not in ceph_stable_releases) + - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis or ceph_origin == "distro" - or ceph_dev or ceph_custom - name: install distro or red hat storage ceph osd via yum @@ -130,9 +128,8 @@ when: - osd_group_name in group_names - ansible_pkg_mgr == "yum" - - (ceph_stable and ceph_stable_release not in ceph_stable_releases) + - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis or ceph_origin == "distro" - or ceph_dev or ceph_custom - name: install distro or red hat storage ceph osd via dnf @@ -142,9 +139,8 @@ when: - osd_group_name in group_names - ansible_pkg_mgr == "dnf" - - (ceph_stable and ceph_stable_release not in ceph_stable_releases) + - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis or ceph_origin == "distro" - or ceph_dev or ceph_custom - name: install distro or red hat storage ceph mds via yum @@ -154,9 +150,8 @@ when: - mds_group_name in group_names - ansible_pkg_mgr == "yum" - - (ceph_stable and ceph_stable_release not in ceph_stable_releases) + - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis or ceph_origin == "distro" - or ceph_dev or ceph_custom - name: install distro or red hat storage ceph mds via dnf @@ -166,9 +161,8 @@ when: - mds_group_name in group_names - ansible_pkg_mgr == "dnf" - - (ceph_stable and ceph_stable_release not in ceph_stable_releases) + - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis or ceph_origin == "distro" - or ceph_dev or ceph_custom - name: install distro or red hat storage ceph base via yum @@ -178,9 +172,8 @@ when: - client_group_name in group_names - ansible_pkg_mgr == "yum" - - (ceph_stable and ceph_stable_release not in ceph_stable_releases) + - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis or ceph_origin == "distro" - or ceph_dev or ceph_custom - name: install distro or red hat storage ceph base via dnf @@ -190,9 +183,8 @@ when: - client_group_name in group_names - ansible_pkg_mgr == "dnf" - - (ceph_stable and ceph_stable_release not in ceph_stable_releases) + - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis or ceph_origin == "distro" - or ceph_dev or ceph_custom - name: install ceph-test diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index 7ae1ac9e3..f43c919b9 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -3,6 +3,9 @@ - include: ./checks/check_mandatory_vars.yml +# Set ceph_release +- include: ./release.yml + - include: ./checks/check_firewall.yml when: check_firewall # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) @@ -108,77 +111,77 @@ dir_owner: ceph dir_group: ceph dir_mode: "0755" - when: is_after_hammer + when: ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - set_fact: dir_owner: root dir_group: root dir_mode: "0755" - when: is_before_infernalis + when: ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - set_fact: key_owner: root key_group: root key_mode: "0600" - when: is_before_infernalis + when: ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - set_fact: key_owner: ceph key_group: ceph key_mode: "0600" - when: is_after_hammer + when: ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - set_fact: activate_file_owner: ceph activate_file_group: ceph activate_file_mode: "0644" - when: is_after_hammer + when: ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - set_fact: activate_file_owner: root activate_file_group: root activate_file_mode: "0644" - when: is_before_infernalis + when: ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - set_fact: rbd_client_directory_owner: root when: - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - rbd_client_directory_owner is not defined or not rbd_client_directory_owner - set_fact: rbd_client_directory_owner: ceph when: - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - rbd_client_directory_owner is not defined or not rbd_client_directory_owner - set_fact: rbd_client_directory_group: root when: - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - rbd_client_directory_group is not defined or not rbd_client_directory_group - set_fact: rbd_client_directory_group: ceph when: - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - rbd_client_directory_group is not defined or not rbd_client_directory_group - set_fact: rbd_client_directory_mode: "1777" when: - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - rbd_client_directory_mode is not defined or not rbd_client_directory_mode - set_fact: rbd_client_directory_mode: "0770" when: - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - rbd_client_directory_mode is not defined or not rbd_client_directory_mode diff --git a/roles/ceph-mds/tasks/pre_requisite.yml b/roles/ceph-mds/tasks/pre_requisite.yml index 1c59fd0ef..bc9d18c06 100644 --- a/roles/ceph-mds/tasks/pre_requisite.yml +++ b/roles/ceph-mds/tasks/pre_requisite.yml @@ -76,7 +76,7 @@ failed_when: false when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: start and add that the metadata service to the init sequence (upstart) command: initctl emit ceph-mds cluster={{ cluster }} id={{ mds_name }} @@ -93,7 +93,7 @@ changed_when: false when: - not use_systemd - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: start and add that the metadata service to the init sequence (systemd after hammer) service: @@ -103,4 +103,4 @@ changed_when: false when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer diff --git a/roles/ceph-mon/tasks/deploy_monitors.yml b/roles/ceph-mon/tasks/deploy_monitors.yml index 78518b4a3..eef3f1e6a 100644 --- a/roles/ceph-mon/tasks/deploy_monitors.yml +++ b/roles/ceph-mon/tasks/deploy_monitors.yml @@ -50,7 +50,7 @@ creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/keyring when: - cephx - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: ceph monitor mkfs without keyring (for or after infernalis release) command: ceph-mon --cluster {{ cluster }} --setuser ceph --setgroup ceph --mkfs -i {{ monitor_name }} --fsid {{ fsid }} @@ -58,7 +58,7 @@ creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/store.db when: - not cephx - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: ceph monitor mkfs with keyring (before infernalis release) command: ceph-mon --mkfs -i {{ monitor_name }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ monitor_name }} @@ -66,7 +66,7 @@ creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/keyring when: - cephx - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: ceph monitor mkfs without keyring (before infernalis release) command: ceph-mon --mkfs -i {{ monitor_name }} --fsid {{ fsid }} @@ -74,4 +74,4 @@ creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/store.db when: - not cephx - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index 1842802c9..d1be15c00 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -47,7 +47,7 @@ failed_when: false when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: start the monitor service (for or after infernalis) service: @@ -57,7 +57,7 @@ changed_when: false when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: collect admin and bootstrap keys command: ceph-create-keys --cluster {{ cluster }} --id {{ monitor_name }} diff --git a/roles/ceph-osd/tasks/activate_osds.yml b/roles/ceph-osd/tasks/activate_osds.yml index f4aff7191..a4bc7ea7a 100644 --- a/roles/ceph-osd/tasks/activate_osds.yml +++ b/roles/ceph-osd/tasks/activate_osds.yml @@ -89,7 +89,7 @@ - ansible_selinux != false - ansible_selinux['status'] == 'enabled' - ansible_selinux['config_mode'] != 'disabled' - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: start and add that the osd service(s) to the init sequence (before infernalis) service: @@ -98,7 +98,7 @@ enabled: yes when: - ansible_distribution != "Ubuntu" - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: get osd id (for or after infernalis) shell: 'ls /var/lib/ceph/osd/ | grep -oP "\d+$"' @@ -107,7 +107,7 @@ register: osd_id when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: enable the osd service (for or after infernalis) command: systemctl enable ceph-osd@{{ item }} @@ -116,7 +116,7 @@ with_items: "{{ osd_id.stdout_lines }}" when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: start and add that the osd service(s) to the init sequence (for or after infernalis) service: @@ -127,4 +127,4 @@ changed_when: false when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer diff --git a/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml b/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml index 8359f38bb..3b0240d7c 100644 --- a/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml +++ b/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml @@ -12,7 +12,7 @@ changed_when: false when: - use_systemd - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: enable systemd unit file for the rbd mirror service (systemd after hammer) command: systemctl enable ceph-rbd-mirror@{{ ceph_rbd_mirror_local_user }} @@ -20,7 +20,7 @@ failed_when: false when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: start and add that the rbd mirror service to the init sequence (systemd after hammer) service: @@ -30,4 +30,4 @@ changed_when: false when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer diff --git a/roles/ceph-rgw/tasks/main.yml b/roles/ceph-rgw/tasks/main.yml index ca2f9ea78..9796abb8e 100644 --- a/roles/ceph-rgw/tasks/main.yml +++ b/roles/ceph-rgw/tasks/main.yml @@ -16,7 +16,7 @@ - name: include rgw multisite playbooks include: multisite/main.yml - when: rgw_zone is defined and rgw_multisite and ( is_jewel or is_after_jewel ) + when: rgw_zone is defined and rgw_multisite and ( ceph_release_num.{{ ceph_release}} >= ceph_release_num.jewel ) # 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-rgw/tasks/pre_requisite.yml b/roles/ceph-rgw/tasks/pre_requisite.yml index c4306ed27..ebcab44cd 100644 --- a/roles/ceph-rgw/tasks/pre_requisite.yml +++ b/roles/ceph-rgw/tasks/pre_requisite.yml @@ -47,7 +47,7 @@ creates: /var/run/systemd/generator.late/ceph-radosgw.service when: - ansible_os_family == "RedHat" - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: activate rados gateway with upstart file: diff --git a/roles/ceph-rgw/tasks/start_radosgw.yml b/roles/ceph-rgw/tasks/start_radosgw.yml index dbd9e6732..adc226411 100644 --- a/roles/ceph-rgw/tasks/start_radosgw.yml +++ b/roles/ceph-rgw/tasks/start_radosgw.yml @@ -26,7 +26,7 @@ enabled: yes when: - ansible_os_family == 'RedHat' - - is_before_infernalis + - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis - name: enable systemd unit file for rgw instance (for or after infernalis) command: systemctl enable ceph-radosgw@rgw.{{ ansible_hostname }} @@ -34,7 +34,7 @@ failed_when: false when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer - name: start rgw with systemd (for or after infernalis) service: @@ -43,4 +43,4 @@ enabled: yes when: - use_systemd - - is_after_hammer + - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer From d4a60a9394e938ee2472c5c973ecbb1f79603b11 Mon Sep 17 00:00:00 2001 From: James Saint-Rossy Date: Fri, 9 Sep 2016 18:16:41 -0400 Subject: [PATCH 5/8] Added ceph_release generation and fixed missing whitespace in ceph_release checks --- roles/ceph-common-coreos/defaults/main.yml | 2 +- roles/ceph-common-coreos/tasks/main.yml | 2 +- roles/ceph-common/handlers/main.yml | 18 +++++++------- .../tasks/installs/install_on_redhat.yml | 18 +++++++------- roles/ceph-common/tasks/main.yml | 24 +++++++++---------- roles/ceph-common/tasks/release.yml | 11 +++++++++ roles/ceph-mds/tasks/pre_requisite.yml | 6 ++--- roles/ceph-mon/tasks/deploy_monitors.yml | 8 +++---- roles/ceph-mon/tasks/start_monitor.yml | 4 ++-- roles/ceph-osd/tasks/activate_osds.yml | 10 ++++---- .../tasks/start_rbd_mirror.yml | 6 ++--- roles/ceph-rgw/tasks/main.yml | 2 +- roles/ceph-rgw/tasks/pre_requisite.yml | 2 +- roles/ceph-rgw/tasks/start_radosgw.yml | 6 ++--- 14 files changed, 65 insertions(+), 54 deletions(-) create mode 100644 roles/ceph-common/tasks/release.yml diff --git a/roles/ceph-common-coreos/defaults/main.yml b/roles/ceph-common-coreos/defaults/main.yml index 8b21fb830..6263de700 100644 --- a/roles/ceph-common-coreos/defaults/main.yml +++ b/roles/ceph-common-coreos/defaults/main.yml @@ -4,4 +4,4 @@ coreos_pypy_url: https://bitbucket.org/pypy/pypy/downloads/pypy-{{coreos_pypy_ve pypy_directory: /opt/pypy pypy_binary_directory: /opt/bin pip_url: https://bootstrap.pypa.io/get-pip.py -local_temp_directory: /tmp \ No newline at end of file +local_temp_directory: /tmp diff --git a/roles/ceph-common-coreos/tasks/main.yml b/roles/ceph-common-coreos/tasks/main.yml index 4f3404a14..7e3665afc 100644 --- a/roles/ceph-common-coreos/tasks/main.yml +++ b/roles/ceph-common-coreos/tasks/main.yml @@ -13,4 +13,4 @@ ignore_errors: true - include: install_pip.yml - when: need_pip | failed and need_python | failed \ No newline at end of file + when: need_pip | failed and need_python | failed diff --git a/roles/ceph-common/handlers/main.yml b/roles/ceph-common/handlers/main.yml index 9a547d1a6..cf54487f4 100644 --- a/roles/ceph-common/handlers/main.yml +++ b/roles/ceph-common/handlers/main.yml @@ -9,7 +9,7 @@ - socket.rc == 0 - ansible_distribution != 'Ubuntu' - mon_group_name in group_names - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: restart ceph mons with systemd service: @@ -19,7 +19,7 @@ - socket.rc == 0 - use_systemd - mon_group_name in group_names - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: restart ceph mons on ubuntu command: initctl restart ceph-mon cluster={{ cluster }} id={{ monitor_name }} @@ -35,7 +35,7 @@ - socket.rc == 0 - ansible_distribution != 'Ubuntu' - osd_group_name in group_names - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis # This does not just restart OSDs but everything else too. Unfortunately # at this time the ansible role does not have an OSD id list to use @@ -48,7 +48,7 @@ - socket.rc == 0 - use_systemd - osd_group_name in group_names - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: restart ceph osds on ubuntu shell: | @@ -76,7 +76,7 @@ - ansible_distribution != 'Ubuntu' - use_systemd - mds_group_name in group_names - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: restart ceph mdss with systemd service: @@ -86,7 +86,7 @@ - socket.rc == 0 - use_systemd - mds_group_name in group_names - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: restart ceph rgws on ubuntu command: initctl restart radosgw cluster={{ cluster }} id=rgw.{{ ansible_hostname }} @@ -102,7 +102,7 @@ - socketrgw.rc == 0 - ansible_distribution != 'Ubuntu' - rgw_group_name in group_names - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: restart ceph rgws on red hat command: /etc/init.d/ceph-radosgw restart @@ -110,7 +110,7 @@ - socketrgw.rc == 0 - ansible_os_family == 'RedHat' - rgw_group_name in group_names - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: restart ceph rgws with systemd service: @@ -120,7 +120,7 @@ - socketrgw.rc == 0 - use_systemd - rgw_group_name in group_names - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: restart apache2 service: diff --git a/roles/ceph-common/tasks/installs/install_on_redhat.yml b/roles/ceph-common/tasks/installs/install_on_redhat.yml index 3e5826091..83d090a54 100644 --- a/roles/ceph-common/tasks/installs/install_on_redhat.yml +++ b/roles/ceph-common/tasks/installs/install_on_redhat.yml @@ -76,7 +76,7 @@ name: ceph state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" when: - - ceph_release_num.{{ ceph_release}} <= ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} <= ceph_release_num.infernalis - ansible_pkg_mgr == "yum" - ceph_origin != 'local' @@ -106,7 +106,7 @@ when: - mon_group_name in group_names - ansible_pkg_mgr == "yum" - - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_custom @@ -117,7 +117,7 @@ when: - mon_group_name in group_names - ansible_pkg_mgr == "dnf" - - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_custom @@ -128,7 +128,7 @@ when: - osd_group_name in group_names - ansible_pkg_mgr == "yum" - - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_custom @@ -139,7 +139,7 @@ when: - osd_group_name in group_names - ansible_pkg_mgr == "dnf" - - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_custom @@ -150,7 +150,7 @@ when: - mds_group_name in group_names - ansible_pkg_mgr == "yum" - - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_custom @@ -161,7 +161,7 @@ when: - mds_group_name in group_names - ansible_pkg_mgr == "dnf" - - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_custom @@ -172,7 +172,7 @@ when: - client_group_name in group_names - ansible_pkg_mgr == "yum" - - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_custom @@ -183,7 +183,7 @@ when: - client_group_name in group_names - ansible_pkg_mgr == "dnf" - - ceph_release_num.{{ ceph_release}} > ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_custom diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index f43c919b9..647293bfc 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -111,77 +111,77 @@ dir_owner: ceph dir_group: ceph dir_mode: "0755" - when: ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + when: ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - set_fact: dir_owner: root dir_group: root dir_mode: "0755" - when: ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + when: ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - set_fact: key_owner: root key_group: root key_mode: "0600" - when: ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + when: ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - set_fact: key_owner: ceph key_group: ceph key_mode: "0600" - when: ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + when: ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - set_fact: activate_file_owner: ceph activate_file_group: ceph activate_file_mode: "0644" - when: ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + when: ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - set_fact: activate_file_owner: root activate_file_group: root activate_file_mode: "0644" - when: ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + when: ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - set_fact: rbd_client_directory_owner: root when: - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - rbd_client_directory_owner is not defined or not rbd_client_directory_owner - set_fact: rbd_client_directory_owner: ceph when: - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - rbd_client_directory_owner is not defined or not rbd_client_directory_owner - set_fact: rbd_client_directory_group: root when: - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - rbd_client_directory_group is not defined or not rbd_client_directory_group - set_fact: rbd_client_directory_group: ceph when: - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - rbd_client_directory_group is not defined or not rbd_client_directory_group - set_fact: rbd_client_directory_mode: "1777" when: - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - rbd_client_directory_mode is not defined or not rbd_client_directory_mode - set_fact: rbd_client_directory_mode: "0770" when: - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - rbd_client_directory_mode is not defined or not rbd_client_directory_mode diff --git a/roles/ceph-common/tasks/release.yml b/roles/ceph-common/tasks/release.yml new file mode 100644 index 000000000..ec190d363 --- /dev/null +++ b/roles/ceph-common/tasks/release.yml @@ -0,0 +1,11 @@ +--- +# Set ceph_release to ceph_stable by default +- set_fact: + ceph_release: "{{ ceph_stable_release }}" + +# Set ceph_release to latest known release (Which should match ceph_dev) +- set_fact: + ceph_release: "{{ item.key }}" + when: + ceph_dev and ({{ item.value }} > ceph_release_num.{{ ceph_release }}) + with_dict: "{{ ceph_release_num }}" diff --git a/roles/ceph-mds/tasks/pre_requisite.yml b/roles/ceph-mds/tasks/pre_requisite.yml index bc9d18c06..7d20b5acd 100644 --- a/roles/ceph-mds/tasks/pre_requisite.yml +++ b/roles/ceph-mds/tasks/pre_requisite.yml @@ -76,7 +76,7 @@ failed_when: false when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: start and add that the metadata service to the init sequence (upstart) command: initctl emit ceph-mds cluster={{ cluster }} id={{ mds_name }} @@ -93,7 +93,7 @@ changed_when: false when: - not use_systemd - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: start and add that the metadata service to the init sequence (systemd after hammer) service: @@ -103,4 +103,4 @@ changed_when: false when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer diff --git a/roles/ceph-mon/tasks/deploy_monitors.yml b/roles/ceph-mon/tasks/deploy_monitors.yml index eef3f1e6a..910b718e6 100644 --- a/roles/ceph-mon/tasks/deploy_monitors.yml +++ b/roles/ceph-mon/tasks/deploy_monitors.yml @@ -50,7 +50,7 @@ creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/keyring when: - cephx - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: ceph monitor mkfs without keyring (for or after infernalis release) command: ceph-mon --cluster {{ cluster }} --setuser ceph --setgroup ceph --mkfs -i {{ monitor_name }} --fsid {{ fsid }} @@ -58,7 +58,7 @@ creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/store.db when: - not cephx - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: ceph monitor mkfs with keyring (before infernalis release) command: ceph-mon --mkfs -i {{ monitor_name }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ monitor_name }} @@ -66,7 +66,7 @@ creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/keyring when: - cephx - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: ceph monitor mkfs without keyring (before infernalis release) command: ceph-mon --mkfs -i {{ monitor_name }} --fsid {{ fsid }} @@ -74,4 +74,4 @@ creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/store.db when: - not cephx - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index d1be15c00..c308481c0 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -47,7 +47,7 @@ failed_when: false when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: start the monitor service (for or after infernalis) service: @@ -57,7 +57,7 @@ changed_when: false when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: collect admin and bootstrap keys command: ceph-create-keys --cluster {{ cluster }} --id {{ monitor_name }} diff --git a/roles/ceph-osd/tasks/activate_osds.yml b/roles/ceph-osd/tasks/activate_osds.yml index a4bc7ea7a..1662f8b29 100644 --- a/roles/ceph-osd/tasks/activate_osds.yml +++ b/roles/ceph-osd/tasks/activate_osds.yml @@ -89,7 +89,7 @@ - ansible_selinux != false - ansible_selinux['status'] == 'enabled' - ansible_selinux['config_mode'] != 'disabled' - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: start and add that the osd service(s) to the init sequence (before infernalis) service: @@ -98,7 +98,7 @@ enabled: yes when: - ansible_distribution != "Ubuntu" - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: get osd id (for or after infernalis) shell: 'ls /var/lib/ceph/osd/ | grep -oP "\d+$"' @@ -107,7 +107,7 @@ register: osd_id when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: enable the osd service (for or after infernalis) command: systemctl enable ceph-osd@{{ item }} @@ -116,7 +116,7 @@ with_items: "{{ osd_id.stdout_lines }}" when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: start and add that the osd service(s) to the init sequence (for or after infernalis) service: @@ -127,4 +127,4 @@ changed_when: false when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer diff --git a/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml b/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml index 3b0240d7c..e64ef7532 100644 --- a/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml +++ b/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml @@ -12,7 +12,7 @@ changed_when: false when: - use_systemd - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: enable systemd unit file for the rbd mirror service (systemd after hammer) command: systemctl enable ceph-rbd-mirror@{{ ceph_rbd_mirror_local_user }} @@ -20,7 +20,7 @@ failed_when: false when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: start and add that the rbd mirror service to the init sequence (systemd after hammer) service: @@ -30,4 +30,4 @@ changed_when: false when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer diff --git a/roles/ceph-rgw/tasks/main.yml b/roles/ceph-rgw/tasks/main.yml index 9796abb8e..ab1d53ae5 100644 --- a/roles/ceph-rgw/tasks/main.yml +++ b/roles/ceph-rgw/tasks/main.yml @@ -16,7 +16,7 @@ - name: include rgw multisite playbooks include: multisite/main.yml - when: rgw_zone is defined and rgw_multisite and ( ceph_release_num.{{ ceph_release}} >= ceph_release_num.jewel ) + when: rgw_zone is defined and rgw_multisite and ( ceph_release_num.{{ ceph_release }} >= ceph_release_num.jewel ) # 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-rgw/tasks/pre_requisite.yml b/roles/ceph-rgw/tasks/pre_requisite.yml index ebcab44cd..d6ccda14a 100644 --- a/roles/ceph-rgw/tasks/pre_requisite.yml +++ b/roles/ceph-rgw/tasks/pre_requisite.yml @@ -47,7 +47,7 @@ creates: /var/run/systemd/generator.late/ceph-radosgw.service when: - ansible_os_family == "RedHat" - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: activate rados gateway with upstart file: diff --git a/roles/ceph-rgw/tasks/start_radosgw.yml b/roles/ceph-rgw/tasks/start_radosgw.yml index adc226411..9d1547ca3 100644 --- a/roles/ceph-rgw/tasks/start_radosgw.yml +++ b/roles/ceph-rgw/tasks/start_radosgw.yml @@ -26,7 +26,7 @@ enabled: yes when: - ansible_os_family == 'RedHat' - - ceph_release_num.{{ ceph_release}} < ceph_release_num.infernalis + - ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis - name: enable systemd unit file for rgw instance (for or after infernalis) command: systemctl enable ceph-radosgw@rgw.{{ ansible_hostname }} @@ -34,7 +34,7 @@ failed_when: false when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer - name: start rgw with systemd (for or after infernalis) service: @@ -43,4 +43,4 @@ enabled: yes when: - use_systemd - - ceph_release_num.{{ ceph_release}} > ceph_release_num.hammer + - ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer From d36a99e41b25b505fd4625c0661902d63bf7df30 Mon Sep 17 00:00:00 2001 From: James Saint-Rossy Date: Mon, 26 Sep 2016 09:19:15 -0400 Subject: [PATCH 6/8] Used list style ands for better readibility and fixed legacy debian checks --- roles/ceph-common/tasks/release.yml | 3 ++- roles/ceph-mon/tasks/start_monitor.yml | 6 ++++-- roles/ceph-rgw/tasks/main.yml | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/roles/ceph-common/tasks/release.yml b/roles/ceph-common/tasks/release.yml index ec190d363..3bb54e038 100644 --- a/roles/ceph-common/tasks/release.yml +++ b/roles/ceph-common/tasks/release.yml @@ -7,5 +7,6 @@ - set_fact: ceph_release: "{{ item.key }}" when: - ceph_dev and ({{ item.value }} > ceph_release_num.{{ ceph_release }}) + - ceph_dev + - ({{ item.value }} > ceph_release_num.{{ ceph_release }}) with_dict: "{{ ceph_release_num }}" diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index c308481c0..0999673fa 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -21,6 +21,7 @@ - not use_systemd # legacy ceph system v init scripts require a mon section in order to work +# Not Ubuntu so we can catch old debian systems that don't use systemd or upstart - name: add mon section into ceph.conf for systemv init scripts ini_file: dest: /etc/ceph/{{ cluster }}.conf @@ -29,16 +30,17 @@ value: "{{ ansible_host }}" state: present when: - - ansible_os_family == "RedHat" + - ansible_os_family != "Ubuntu" - ceph_release_num.{{ ceph_stable_release }} < ceph_release_num.infernalis # NOTE (jsaintrocc): can't use service module because we need to use the # legacy systemv init for older ceph releases. Even when the os supports systemd +# Not Ubuntu so we can catch old debian systems that don't use systemd or upstart - name: start and add that the monitor service to the init sequence command: service ceph start mon changed_when: false when: - - ansible_os_family == "RedHat" + - ansible_os_family != "Ubuntu" - ceph_release_num.{{ ceph_stable_release }} < ceph_release_num.infernalis - name: start and add that the monitor service to the init sequence (for or after infernalis) diff --git a/roles/ceph-rgw/tasks/main.yml b/roles/ceph-rgw/tasks/main.yml index ab1d53ae5..5fb5699cd 100644 --- a/roles/ceph-rgw/tasks/main.yml +++ b/roles/ceph-rgw/tasks/main.yml @@ -16,7 +16,10 @@ - name: include rgw multisite playbooks include: multisite/main.yml - when: rgw_zone is defined and rgw_multisite and ( ceph_release_num.{{ ceph_release }} >= ceph_release_num.jewel ) + when: + - rgw_zone is defined + - rgw_multisite + - ( ceph_release_num.{{ ceph_release }} >= ceph_release_num.jewel ) # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False From 99f1caa120451f5187c6c9ce06421a874a571796 Mon Sep 17 00:00:00 2001 From: James Saint-Rossy Date: Mon, 26 Sep 2016 11:33:17 -0400 Subject: [PATCH 7/8] Fixed check to legacy ceph_stable_releases list --- roles/ceph-common/tasks/installs/install_on_redhat.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/ceph-common/tasks/installs/install_on_redhat.yml b/roles/ceph-common/tasks/installs/install_on_redhat.yml index 1dad511de..40dfa6882 100644 --- a/roles/ceph-common/tasks/installs/install_on_redhat.yml +++ b/roles/ceph-common/tasks/installs/install_on_redhat.yml @@ -172,7 +172,7 @@ when: - client_group_name in group_names - ansible_pkg_mgr == "yum" - - (ceph_stable and ceph_stable_release not in ceph_stable_releases) + - ceph_release_num.{{ ceph_release }} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_dev or ceph_custom @@ -184,7 +184,7 @@ when: - client_group_name in group_names - ansible_pkg_mgr == "dnf" - - (ceph_stable and ceph_stable_release not in ceph_stable_releases) + - ceph_release_num.{{ ceph_release }} > ceph_release_num.infernalis or ceph_origin == "distro" or ceph_dev or ceph_custom From 9c7dac6b944c17c3799e97375f169c5c888c1db4 Mon Sep 17 00:00:00 2001 From: James Saint-Rossy Date: Fri, 30 Sep 2016 11:43:53 -0400 Subject: [PATCH 8/8] Updated release version check --- roles/ceph-mon/tasks/create_mds_filesystems.yml | 4 ++-- roles/ceph-mon/tasks/secure_cluster.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/ceph-mon/tasks/create_mds_filesystems.yml b/roles/ceph-mon/tasks/create_mds_filesystems.yml index fd34f6d05..8b784f35d 100644 --- a/roles/ceph-mon/tasks/create_mds_filesystems.yml +++ b/roles/ceph-mon/tasks/create_mds_filesystems.yml @@ -9,9 +9,9 @@ - cephfs_data - cephfs_metadata changed_when: false - when: not {{ ceph_version | version_compare('0.84.0', '<') }} + when: ceph_release_num.{{ ceph_release }} > ceph_release_num.firefly - name: create ceph filesystem command: ceph --cluster {{ cluster }} fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }} changed_when: false - when: not {{ ceph_version | version_compare('0.84.0', '<') }} + when: ceph_release_num.{{ ceph_release }} > ceph_release_num.firefly diff --git a/roles/ceph-mon/tasks/secure_cluster.yml b/roles/ceph-mon/tasks/secure_cluster.yml index 9c67becea..a12d08f49 100644 --- a/roles/ceph-mon/tasks/secure_cluster.yml +++ b/roles/ceph-mon/tasks/secure_cluster.yml @@ -9,4 +9,4 @@ with_nested: - "{{ ceph_pools.stdout_lines|default([]) }}" - secure_cluster_flags - when: "{{ ceph_version | version_compare('0.94.0', '>=') }}" + when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.hammer