ceph-ansible/roles/ceph-common/tasks/facts.yml

73 lines
2.0 KiB
YAML

---
- name: get ceph version
command: ceph --version
changed_when: false
always_run: true
register: ceph_version
- set_fact:
ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
# NOTE(mattt): On ansible 2.x we can use ansible_service_mgr instead
- name: check init system
slurp:
src: /proc/1/comm
always_run: true
register: init_system
- set_fact:
init_system={{ init_system.content | b64decode | trim }}
- 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
- set_fact:
mds_name: "{{ ansible_fqdn }}"
when: mds_use_fqdn