mirror of https://github.com/ceph/ceph-ansible.git
Merge pull request #737 from ceph/issue-736
Define readable vars for Ceph version comparisonspull/739/head
commit
066e172c6b
|
@ -8,8 +8,8 @@
|
||||||
when:
|
when:
|
||||||
socket.rc == 0 and
|
socket.rc == 0 and
|
||||||
ansible_distribution != 'Ubuntu' and
|
ansible_distribution != 'Ubuntu' and
|
||||||
mon_group_name in group_names and not
|
mon_group_name in group_names and
|
||||||
is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
- name: restart ceph mons with systemd
|
- name: restart ceph mons with systemd
|
||||||
service:
|
service:
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
socket.rc == 0 and
|
socket.rc == 0 and
|
||||||
ansible_distribution != 'Ubuntu' and
|
ansible_distribution != 'Ubuntu' and
|
||||||
mon_group_name in group_names and
|
mon_group_name in group_names and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: restart ceph mons on ubuntu
|
- name: restart ceph mons on ubuntu
|
||||||
command: initctl restart ceph-mon cluster={{ cluster }} id={{ monitor_name }}
|
command: initctl restart ceph-mon cluster={{ cluster }} id={{ monitor_name }}
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
socket.rc == 0 and
|
socket.rc == 0 and
|
||||||
ansible_distribution != 'Ubuntu' and
|
ansible_distribution != 'Ubuntu' and
|
||||||
osd_group_name in group_names and
|
osd_group_name in group_names and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
# This does not just restart OSDs but everything else too. Unfortunately
|
# 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
|
# at this time the ansible role does not have an OSD id list to use
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
socket.rc == 0 and
|
socket.rc == 0 and
|
||||||
ansible_distribution != 'Ubuntu' and
|
ansible_distribution != 'Ubuntu' and
|
||||||
osd_group_name in group_names and
|
osd_group_name in group_names and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: restart ceph osds on ubuntu
|
- name: restart ceph osds on ubuntu
|
||||||
shell: |
|
shell: |
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
socketrgw.rc == 0 and
|
socketrgw.rc == 0 and
|
||||||
ansible_distribution != 'Ubuntu' and
|
ansible_distribution != 'Ubuntu' and
|
||||||
rgw_group_name in group_names and
|
rgw_group_name in group_names and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
- name: restart ceph rgws on red hat
|
- name: restart ceph rgws on red hat
|
||||||
command: /etc/init.d/ceph-radosgw restart
|
command: /etc/init.d/ceph-radosgw restart
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
socketrgw.rc == 0 and
|
socketrgw.rc == 0 and
|
||||||
ansible_os_family == 'RedHat' and
|
ansible_os_family == 'RedHat' and
|
||||||
rgw_group_name in group_names and
|
rgw_group_name in group_names and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
- name: restart ceph rgws with systemd
|
- name: restart ceph rgws with systemd
|
||||||
service:
|
service:
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
socketrgw.rc == 0 and
|
socketrgw.rc == 0 and
|
||||||
ansible_distribution != 'Ubuntu' and
|
ansible_distribution != 'Ubuntu' and
|
||||||
rgw_group_name in group_names and
|
rgw_group_name in group_names and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: restart apache2
|
- name: restart apache2
|
||||||
service:
|
service:
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: get ceph version
|
||||||
|
command: ceph --version
|
||||||
|
changed_when: false
|
||||||
|
register: ceph_version
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
|
||||||
|
|
||||||
|
# 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', '<') }}
|
|
@ -64,95 +64,83 @@
|
||||||
tags:
|
tags:
|
||||||
- package-install
|
- package-install
|
||||||
|
|
||||||
- name: get ceph version
|
- include: facts.yml
|
||||||
command: ceph --version
|
|
||||||
changed_when: false
|
|
||||||
register: ceph_version
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
|
|
||||||
|
|
||||||
# NOTE (leseb/jsaintrocc): Your supposed to qoute variables
|
|
||||||
# that follow colons to avoid confusion with dicts but this
|
|
||||||
# causes issues with the boolean, so we keep this syntax styling...
|
|
||||||
- set_fact:
|
|
||||||
is_ceph_infernalis={{ ceph_version | version_compare('9.2.0', '>=') }}
|
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
dir_owner: ceph
|
dir_owner: ceph
|
||||||
dir_group: ceph
|
dir_group: ceph
|
||||||
dir_mode: "0755"
|
dir_mode: "0755"
|
||||||
when: is_ceph_infernalis
|
when: is_after_hammer
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
dir_owner: root
|
dir_owner: root
|
||||||
dir_group: root
|
dir_group: root
|
||||||
dir_mode: "0755"
|
dir_mode: "0755"
|
||||||
when: not is_ceph_infernalis
|
when: is_before_infernalis
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
key_owner: root
|
key_owner: root
|
||||||
key_group: root
|
key_group: root
|
||||||
key_mode: "0600"
|
key_mode: "0600"
|
||||||
when: not is_ceph_infernalis
|
when: is_before_infernalis
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
key_owner: ceph
|
key_owner: ceph
|
||||||
key_group: ceph
|
key_group: ceph
|
||||||
key_mode: "0600"
|
key_mode: "0600"
|
||||||
when: is_ceph_infernalis
|
when: is_after_hammer
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
activate_file_owner: ceph
|
activate_file_owner: ceph
|
||||||
activate_file_group: ceph
|
activate_file_group: ceph
|
||||||
activate_file_mode: "0644"
|
activate_file_mode: "0644"
|
||||||
when: is_ceph_infernalis
|
when: is_after_hammer
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
activate_file_owner: root
|
activate_file_owner: root
|
||||||
activate_file_group: root
|
activate_file_group: root
|
||||||
activate_file_mode: "0644"
|
activate_file_mode: "0644"
|
||||||
when: not is_ceph_infernalis
|
when: is_before_infernalis
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
rbd_client_directory_owner: root
|
rbd_client_directory_owner: root
|
||||||
when:
|
when:
|
||||||
not is_ceph_infernalis and
|
is_before_infernalis and
|
||||||
(rbd_client_directory_owner is not defined or
|
(rbd_client_directory_owner is not defined or
|
||||||
not rbd_client_directory_owner)
|
not rbd_client_directory_owner)
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
rbd_client_directory_owner: ceph
|
rbd_client_directory_owner: ceph
|
||||||
when:
|
when:
|
||||||
is_ceph_infernalis and
|
is_after_hammer and
|
||||||
(rbd_client_directory_owner is not defined or
|
(rbd_client_directory_owner is not defined or
|
||||||
not rbd_client_directory_owner)
|
not rbd_client_directory_owner)
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
rbd_client_directory_group: root
|
rbd_client_directory_group: root
|
||||||
when:
|
when:
|
||||||
not is_ceph_infernalis and
|
is_before_infernalis and
|
||||||
(rbd_client_directory_group is not defined or
|
(rbd_client_directory_group is not defined or
|
||||||
not rbd_client_directory_group)
|
not rbd_client_directory_group)
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
rbd_client_directory_group: ceph
|
rbd_client_directory_group: ceph
|
||||||
when:
|
when:
|
||||||
is_ceph_infernalis and
|
is_after_hammer and
|
||||||
(rbd_client_directory_group is not defined or
|
(rbd_client_directory_group is not defined or
|
||||||
not rbd_client_directory_group)
|
not rbd_client_directory_group)
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
rbd_client_directory_mode: "1777"
|
rbd_client_directory_mode: "1777"
|
||||||
when:
|
when:
|
||||||
not is_ceph_infernalis and
|
is_before_infernalis and
|
||||||
(rbd_client_directory_mode is not defined or
|
(rbd_client_directory_mode is not defined or
|
||||||
not rbd_client_directory_mode)
|
not rbd_client_directory_mode)
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
rbd_client_directory_mode: "0770"
|
rbd_client_directory_mode: "0770"
|
||||||
when:
|
when:
|
||||||
is_ceph_infernalis and
|
is_after_hammer and
|
||||||
(rbd_client_directory_mode is not defined or
|
(rbd_client_directory_mode is not defined or
|
||||||
not rbd_client_directory_mode)
|
not rbd_client_directory_mode)
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
failed_when: false
|
failed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: start and add that the metadata service to the init sequence (ubuntu)
|
- name: start and add that the metadata service to the init sequence (ubuntu)
|
||||||
command: initctl emit ceph-mds cluster={{ cluster }} id={{ mds_name }}
|
command: initctl emit ceph-mds cluster={{ cluster }} id={{ mds_name }}
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
- name: start and add that the metadata service to the init sequence (for or after infernalis)
|
- name: start and add that the metadata service to the init sequence (for or after infernalis)
|
||||||
service:
|
service:
|
||||||
|
@ -114,4 +114,4 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/keyring
|
creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/keyring
|
||||||
when:
|
when:
|
||||||
cephx and
|
cephx and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: ceph monitor mkfs without keyring (for or after infernalis release)
|
- name: ceph monitor mkfs without keyring (for or after infernalis release)
|
||||||
command: ceph-mon --setuser ceph --setgroup ceph --mkfs -i {{ monitor_name }} --fsid {{ fsid }}
|
command: ceph-mon --setuser ceph --setgroup ceph --mkfs -i {{ monitor_name }} --fsid {{ fsid }}
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/store.db
|
creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/store.db
|
||||||
when:
|
when:
|
||||||
not cephx and
|
not cephx and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: ceph monitor mkfs with keyring (before infernalis release)
|
- 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 }}
|
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
|
creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/keyring
|
||||||
when:
|
when:
|
||||||
cephx and
|
cephx and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
- name: ceph monitor mkfs without keyring (before infernalis release)
|
- name: ceph monitor mkfs without keyring (before infernalis release)
|
||||||
command: ceph-mon --mkfs -i {{ monitor_name }} --fsid {{ fsid }}
|
command: ceph-mon --mkfs -i {{ monitor_name }} --fsid {{ fsid }}
|
||||||
|
@ -74,4 +74,4 @@
|
||||||
creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/store.db
|
creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/store.db
|
||||||
when:
|
when:
|
||||||
not cephx and
|
not cephx and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
- name: enable systemd unit file for mon instance (for or after infernalis)
|
- name: enable systemd unit file for mon instance (for or after infernalis)
|
||||||
file:
|
file:
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
failed_when: false
|
failed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: start and add that the monitor service to the init sequence (for or after infernalis)
|
- name: start and add that the monitor service to the init sequence (for or after infernalis)
|
||||||
service:
|
service:
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: collect admin and bootstrap keys
|
- name: collect admin and bootstrap keys
|
||||||
command: ceph-create-keys --cluster {{ cluster }} --id {{ monitor_name }}
|
command: ceph-create-keys --cluster {{ cluster }} --id {{ monitor_name }}
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
ansible_selinux != false and
|
ansible_selinux != false and
|
||||||
ansible_selinux['status'] == 'enabled' and
|
ansible_selinux['status'] == 'enabled' and
|
||||||
ansible_selinux['config_mode'] != 'disabled' and
|
ansible_selinux['config_mode'] != 'disabled' and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
- name: start and add that the osd service(s) to the init sequence (before infernalis)
|
- name: start and add that the osd service(s) to the init sequence (before infernalis)
|
||||||
service:
|
service:
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
enabled: yes
|
enabled: yes
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
- name: get osd id (for or after infernalis)
|
- name: get osd id (for or after infernalis)
|
||||||
shell: "ls /var/lib/ceph/osd/ |grep -oh '[0-9]*'"
|
shell: "ls /var/lib/ceph/osd/ |grep -oh '[0-9]*'"
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
register: osd_id
|
register: osd_id
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: enable osd service instance(s) (for or after infernalis)
|
- name: enable osd service instance(s) (for or after infernalis)
|
||||||
file:
|
file:
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
failed_when: false
|
failed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: start and add that the osd service(s) to the init sequence (for or after infernalis)
|
- name: start and add that the osd service(s) to the init sequence (for or after infernalis)
|
||||||
service:
|
service:
|
||||||
|
@ -97,4 +97,4 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
- name: enable systemd unit file for the rbd mirror service (for or after infernalis)
|
- name: enable systemd unit file for the rbd mirror service (for or after infernalis)
|
||||||
file:
|
file:
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
failed_when: false
|
failed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: start and add that the rbd mirror service to the init sequence (for or after infernalis)
|
- name: start and add that the rbd mirror service to the init sequence (for or after infernalis)
|
||||||
service:
|
service:
|
||||||
|
@ -33,4 +33,4 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
enabled: yes
|
enabled: yes
|
||||||
when:
|
when:
|
||||||
ansible_os_family == 'RedHat' and
|
ansible_os_family == 'RedHat' and
|
||||||
not is_ceph_infernalis
|
is_before_infernalis
|
||||||
|
|
||||||
- name: enable systemd unit file for rgw instance (for or after infernalis)
|
- name: enable systemd unit file for rgw instance (for or after infernalis)
|
||||||
file:
|
file:
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
failed_when: false
|
failed_when: false
|
||||||
when:
|
when:
|
||||||
ansible_distribution != "Ubuntu" and
|
ansible_distribution != "Ubuntu" and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
||||||
- name: start rgw on red hat (after infernalis)
|
- name: start rgw on red hat (after infernalis)
|
||||||
service:
|
service:
|
||||||
|
@ -45,4 +45,4 @@
|
||||||
enabled: yes
|
enabled: yes
|
||||||
when:
|
when:
|
||||||
ansible_os_family == 'RedHat' and
|
ansible_os_family == 'RedHat' and
|
||||||
is_ceph_infernalis
|
is_after_hammer
|
||||||
|
|
Loading…
Reference in New Issue