diff --git a/roles/ceph-common/handlers/main.yml b/roles/ceph-common/handlers/main.yml index ef109b0b6..8aa7cc448 100644 --- a/roles/ceph-common/handlers/main.yml +++ b/roles/ceph-common/handlers/main.yml @@ -8,12 +8,8 @@ when: socket.rc == 0 and ansible_distribution != 'Ubuntu' and - mon_group_name in group_names and - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + mon_group_name in group_names and not + is_ceph_infernalis - name: restart ceph mons with systemd service: @@ -22,12 +18,8 @@ when: socket.rc == 0 and ansible_distribution != 'Ubuntu' and - mon_group_name in group_names and not - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + mon_group_name in group_names and + is_ceph_infernalis - name: restart ceph mons on ubuntu command: restart ceph-mon-all @@ -42,11 +34,7 @@ socket.rc == 0 and ansible_distribution != 'Ubuntu' and osd_group_name in group_names and - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + not is_ceph_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 @@ -58,12 +46,8 @@ when: socket.rc == 0 and ansible_distribution != 'Ubuntu' and - osd_group_name in group_names and not - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + osd_group_name in group_names and + is_ceph_infernalis - name: restart ceph osds on ubuntu command: restart ceph-osd-all @@ -85,12 +69,8 @@ socket.rc == 0 and ansible_distribution != 'Ubuntu' and mds_group_name in group_names and - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') - + ceph_stable and + ceph_stable_release in ceph_stable_releases - name: restart ceph mdss with systemd service: @@ -99,12 +79,9 @@ when: socket.rc == 0 and ansible_distribution != 'Ubuntu' and - mds_group_name in group_names and not - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + mds_group_name in group_names and + ceph_stable and + ceph_stable_release not in ceph_stable_releases - name: restart ceph rgws on ubuntu command: restart ceph-all @@ -119,11 +96,7 @@ socketrgw.rc == 0 and ansible_distribution != 'Ubuntu' and rgw_group_name in group_names and - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + not is_ceph_infernalis - name: restart ceph rgws on red hat command: /etc/init.d/ceph-radosgw restart @@ -131,11 +104,7 @@ socketrgw.rc == 0 and ansible_os_family == 'RedHat' and rgw_group_name in group_names and - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + not is_ceph_infernalis - name: restart ceph rgws with systemd service: @@ -144,12 +113,8 @@ when: socketrgw.rc == 0 and ansible_distribution != 'Ubuntu' and - rgw_group_name in group_names and not - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + rgw_group_name in group_names and + is_ceph_infernalis - 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 2f279d920..4d6659330 100644 --- a/roles/ceph-common/tasks/installs/install_on_redhat.yml +++ b/roles/ceph-common/tasks/installs/install_on_redhat.yml @@ -63,3 +63,10 @@ - rbd_client_log_path - rbd_client_admin_socket_path when: rbd_client_directories + +- name: get ceph rhcs version + shell: rpm -q --qf "%{version}\n" ceph-common | cut -f1,2 -d '.' + changed_when: false + failed_when: false + register: rh_storage_version + when: ceph_stable_rh_storage diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index adae3e641..6b6b4dfea 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -49,7 +49,7 @@ failed_when: false register: socketrgw -- name: create a local fetch directory if it doesn't exist +- name: create a local fetch directory if it does not exist local_action: file path={{ fetch_directory }} state=directory changed_when: false sudo: false @@ -107,3 +107,9 @@ owner: root group: root mode: 0644 + +# NOTE (leseb): be careful with the following +# somehow the YAML syntax using "is_ceph_infernalis: {{" +# does NOT work, so we keep this syntax styling... +- set_fact: + is_ceph_infernalis={{ (ceph_stable and ceph_stable_release not in ceph_stable_releases) or (ceph_stable_rh_storage and (rh_storage_version.stdout | version_compare('0.94', '>'))) }} diff --git a/roles/ceph-mds/tasks/pre_requisite.yml b/roles/ceph-mds/tasks/pre_requisite.yml index 3ef77dda4..485afddea 100644 --- a/roles/ceph-mds/tasks/pre_requisite.yml +++ b/roles/ceph-mds/tasks/pre_requisite.yml @@ -6,7 +6,7 @@ owner: ceph group: ceph mode: 0755 - when: ceph_stable_release not in ceph_stable_releases + when: is_ceph_infernalis - name: create bootstrap-mds directory (before infernalis release) file: @@ -15,7 +15,7 @@ owner: root group: root mode: 0755 - when: cephx and ceph_stable_release in ceph_stable_releases + when: not is_ceph_infernalis - name: copy mds bootstrap key (for or after infernalis release) copy: @@ -24,8 +24,7 @@ owner: ceph group: ceph mode: 0600 - when: - cephx and ceph_stable_release not in ceph_stable_releases + when: is_ceph_infernalis - name: copy mds bootstrap key (before infernalis release) copy: @@ -34,8 +33,7 @@ owner: root group: root mode: 0600 - when: - cephx and ceph_stable_release in ceph_stable_releases + when: not is_ceph_infernalis - name: create mds directory (for or after infernalis release) file: @@ -44,8 +42,7 @@ owner: ceph group: ceph mode: 0755 - when: - cephx and ceph_stable_release not in ceph_stable_releases + when: is_ceph_infernalis - name: create mds directory (before infernalis release) file: @@ -54,8 +51,7 @@ owner: root group: root mode: 0755 - when: - cephx and ceph_stable_release in ceph_stable_releases + when: not is_ceph_infernalis - name: create mds keyring command: ceph --cluster ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/ceph.keyring auth get-or-create mds.{{ ansible_hostname }} osd 'allow rwx' mds 'allow' mon 'allow profile mds' -o /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/keyring @@ -72,7 +68,7 @@ group: ceph when: cephx and - ceph_stable_release not in ceph_stable_releases + is_ceph_infernalis - name: set mds key permissions (before infernalis) file: @@ -81,7 +77,8 @@ owner: root group: root when: - cephx and ceph_stable_release in ceph_stable_releases + cephx and + not is_ceph_infernalis - name: activate metadata server with upstart (for or after infernalis release) file: @@ -96,7 +93,7 @@ changed_when: false when: ansible_distribution == "Ubuntu" and - ceph_stable_release not in ceph_stable_releases + is_ceph_infernalis - name: activate metadata server with upstart (before infernalis release) file: @@ -110,7 +107,8 @@ - upstart changed_when: false when: - ansible_distribution == "Ubuntu" and ceph_stable_release in ceph_stable_releases + ansible_distribution == "Ubuntu" and + not is_ceph_infernalis - name: activate metadata server with sysvinit (for or after infernalis release) file: @@ -125,7 +123,7 @@ changed_when: false when: ansible_distribution != "Ubuntu" and - ceph_stable_release not in ceph_stable_releases + is_ceph_infernalis - name: activate metadata server with sysvinit (before infernalis release) file: @@ -139,7 +137,8 @@ - sysvinit changed_when: false when: - ansible_distribution != "Ubuntu" and ceph_stable_release in ceph_stable_releases + ansible_distribution != "Ubuntu" and + not is_ceph_infernalis - name: start and add that the metadata service to the init sequence (ubuntu) service: @@ -157,7 +156,9 @@ enabled: yes args: mds.{{ ansible_hostname }} changed_when: false - when: ansible_distribution != "Ubuntu" and ceph_stable_release in ceph_stable_releases + when: + ansible_distribution != "Ubuntu" and + not is_ceph_infernalis - name: start and add that the metadata service to the init sequence (for or after infernalis) service: @@ -165,4 +166,6 @@ state: started enabled: yes changed_when: false - when: ansible_distribution != "Ubuntu" and ceph_stable_release not in ceph_stable_releases + when: + ansible_distribution != "Ubuntu" and + is_ceph_infernalis diff --git a/roles/ceph-mon/tasks/deploy_monitors.yml b/roles/ceph-mon/tasks/deploy_monitors.yml index 1982e4105..d898c9fc1 100644 --- a/roles/ceph-mon/tasks/deploy_monitors.yml +++ b/roles/ceph-mon/tasks/deploy_monitors.yml @@ -25,7 +25,15 @@ mode: 0600 owner: ceph group: ceph - when: ceph_stable_release not in ceph_stable_releases + when: is_ceph_infernalis + +- name: set initial monitor key permissions (before infernalis release) + file: + path: /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} + mode: 0600 + owner: root + group: root + when: not is_ceph_infernalis - name: create monitor directory (for or after infernalis release) file: @@ -34,15 +42,7 @@ owner: ceph group: ceph mode: 0755 - when: ceph_stable_release not in ceph_stable_releases - -- name: set initial monitor key permissions (before infernalis release) - file: - path: /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} - mode: 0600 - owner: root - group: root - when: ceph_stable_release in ceph_stable_releases + when: is_ceph_infernalis - name: create monitor directory (before infernalis release) file: @@ -51,16 +51,16 @@ owner: root group: root mode: 0755 - when: ceph_stable_release in ceph_stable_releases + when: not is_ceph_infernalis - name: ceph monitor mkfs (for or after infernalis release) command: ceph-mon --setuser ceph --setgroup ceph --mkfs -i {{ ansible_hostname }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} args: creates: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/keyring - when: ceph_stable_release not in ceph_stable_releases + when: is_ceph_infernalis - name: ceph monitor mkfs (before infernalis release) command: ceph-mon --mkfs -i {{ ansible_hostname }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} args: creates: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/keyring - when: ceph_stable_release in ceph_stable_releases + when: not is_ceph_infernalis diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index d77e9fca0..f0710bd90 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -6,13 +6,13 @@ owner: ceph group: ceph mode: 0600 + changed_when: false with_items: - done - upstart - when: - ansible_distribution == "Ubuntu" and ceph_stable_release not in ceph_stable_releases - - changed_when: false + when: + ansible_distribution == "Ubuntu" and + is_ceph_infernalis - name: activate monitor with upstart before infernalis release file: @@ -21,13 +21,13 @@ owner: root group: root mode: 0600 + changed_when: false with_items: - done - upstart when: ansible_distribution == "Ubuntu" and - ceph_stable_release in ceph_stable_releases - changed_when: false + not is_ceph_infernalis - name: start and add that the monitor service to the init sequence (ubuntu) service: @@ -44,7 +44,7 @@ changed_when: false when: ansible_distribution != "Ubuntu" and - ceph_stable_release in ceph_stable_releases + not is_ceph_infernalis - name: start and add that the monitor service to the init sequence (for or after infernalis) service: @@ -54,7 +54,7 @@ changed_when: false when: ansible_distribution != "Ubuntu" and - ceph_stable_release not in ceph_stable_releases + is_ceph_infernalis - name: collect admin and bootstrap keys command: ceph-create-keys --id {{ ansible_hostname }} diff --git a/roles/ceph-osd/tasks/activate_osds.yml b/roles/ceph-osd/tasks/activate_osds.yml index d3cfe900f..21f2fc3e3 100644 --- a/roles/ceph-osd/tasks/activate_osds.yml +++ b/roles/ceph-osd/tasks/activate_osds.yml @@ -29,23 +29,14 @@ state: started enabled: yes when: - ansible_distribution == "Ubuntu" or - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + ansible_distribution != "Ubuntu" and + not is_ceph_infernalis -- name: start and add that the osd service(s) to the init sequence (on or after infernalis) +- name: start and add that the osd service(s) to the init sequence (for or after infernalis) service: name: ceph.target state: started enabled: yes when: - ansible_distribution != "Ubuntu" and not - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') - + ansible_distribution != "Ubuntu" and + is_ceph_infernalis diff --git a/roles/ceph-osd/tasks/pre_requisite.yml b/roles/ceph-osd/tasks/pre_requisite.yml index 97d3f0367..4f1a5f15e 100644 --- a/roles/ceph-osd/tasks/pre_requisite.yml +++ b/roles/ceph-osd/tasks/pre_requisite.yml @@ -18,7 +18,9 @@ owner: ceph group: ceph mode: 0755 - when: cephx and ceph_stable_release not in ceph_stable_releases + when: + cephx and + is_ceph_infernalis - name: create bootstrap-osd directory (before infernalis release) file: @@ -27,7 +29,9 @@ owner: root group: root mode: 0755 - when: cephx and ceph_stable_release in ceph_stable_releases + when: + cephx and + not is_ceph_infernalis - name: copy osd bootstrap key (for or after infernalis release) copy: @@ -36,7 +40,9 @@ owner: ceph group: ceph mode: 0600 - when: cephx and ceph_stable_release not in ceph_stable_releases + when: + cephx and + is_ceph_infernalis - name: copy osd bootstrap key (before infernalis release) copy: @@ -45,4 +51,6 @@ owner: root group: root mode: 600 - when: cephx and ceph_stable_release in ceph_stable_releases + when: + cephx and + not is_ceph_infernalis diff --git a/roles/ceph-rgw/tasks/pre_requisite.yml b/roles/ceph-rgw/tasks/pre_requisite.yml index 9a415f255..fece7fc9e 100644 --- a/roles/ceph-rgw/tasks/pre_requisite.yml +++ b/roles/ceph-rgw/tasks/pre_requisite.yml @@ -9,7 +9,7 @@ with_items: - /var/lib/ceph/bootstrap-rgw - /var/lib/ceph/radosgw/ceph-rgw.{{ ansible_hostname }} - when: ceph_stable_release not in ceph_stable_releases + when: is_ceph_infernalis - name: create rados gateway directories (before infernalis release) file: @@ -21,7 +21,7 @@ with_items: - /var/lib/ceph/bootstrap-rgw - /var/lib/ceph/radosgw/ceph-rgw.{{ ansible_hostname }} - when: ceph_stable_release in ceph_stable_releases + when: not is_ceph_infernalis - name: copy rados gateway bootstrap key (for or after infernalis release) copy: @@ -30,7 +30,9 @@ owner: ceph group: ceph mode: 0600 - when: cephx and ceph_stable_release not in ceph_stable_releases + when: + cephx and + is_ceph_infernalis - name: copy rados gateway bootstrap key (before infernalis release) copy: @@ -39,7 +41,9 @@ owner: root group: root mode: 0600 - when: cephx and ceph_stable_release in ceph_stable_releases + when: + cephx and + not is_ceph_infernalis - name: create rados gateway keyring command: ceph --cluster ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/ceph.keyring auth get-or-create client.rgw.{{ ansible_hostname }} osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/ceph-rgw.{{ ansible_hostname }}/keyring @@ -54,7 +58,9 @@ mode: 0600 owner: ceph group: ceph - when: cephx and ceph_stable_release not in ceph_stable_releases + when: + cephx and + is_ceph_infernalis - name: set rados gateway key permissions (before infernalis release) file: @@ -62,7 +68,9 @@ mode: 0600 owner: root group: root - when: cephx and ceph_stable_release in ceph_stable_releases + when: + cephx and + not is_ceph_infernalis - name: activate rados gateway with upstart (for or after infernalis release) file: @@ -76,7 +84,8 @@ - upstart changed_when: false when: - ansible_distribution == "Ubuntu" and ceph_stable_release not in ceph_stable_releases + ansible_distribution == "Ubuntu" and + is_ceph_infernalis - name: activate rados gateway with upstart (before infernalis release) file: @@ -90,7 +99,8 @@ - upstart changed_when: false when: - ansible_distribution == "Ubuntu" and ceph_stable_release in ceph_stable_releases + ansible_distribution == "Ubuntu" and + not is_ceph_infernalis - name: activate rados gateway with sysvinit (for or after infernalis release) file: @@ -104,7 +114,8 @@ - sysvinit changed_when: false when: - ansible_distribution != "Ubuntu" and ceph_stable_release not in ceph_stable_releases + ansible_distribution != "Ubuntu" and + is_ceph_infernalis - name: activate rados gateway with sysvinit (before infernalis release) file: @@ -118,7 +129,8 @@ - sysvinit changed_when: false when: - ansible_distribution != "Ubuntu" and ceph_stable_release in ceph_stable_releases + ansible_distribution != "Ubuntu" and + not is_ceph_infernalis - name: generate rados gateway sudoers file template: diff --git a/roles/ceph-rgw/tasks/start_radosgw.yml b/roles/ceph-rgw/tasks/start_radosgw.yml index ef5dc98d7..572824c8f 100644 --- a/roles/ceph-rgw/tasks/start_radosgw.yml +++ b/roles/ceph-rgw/tasks/start_radosgw.yml @@ -29,21 +29,15 @@ name: ceph-radosgw state: started enabled: yes - when: ansible_os_family == 'RedHat' and - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + when: + ansible_os_family == 'RedHat' and + not is_ceph_infernalis - name: start rgw on red hat (after infernalis) service: name: ceph-radosgw@{{ ansible_hostname }} state: started enabled: yes - when: ansible_os_family == 'RedHat' and not - (ceph_stable_release == 'dumpling' or - ceph_stable_release == 'emperor' or - ceph_stable_release == 'firefly' or - ceph_stable_release == 'giant' or - ceph_stable_release == 'hammer') + when: + ansible_os_family == 'RedHat' and + is_ceph_infernalis