Replaced is_before is_after is_ booleans with numerical version dictionary

pull/953/head
James Saint-Rossy 2016-09-09 17:34:26 -04:00
parent f52be23770
commit 666637f715
15 changed files with 60 additions and 125 deletions

View File

@ -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

View File

@ -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:

View File

@ -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/

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 }}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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