# - All previous versions from Canonical
# - Infernalis from ceph.com
- name: debian based systems - configure cluster name
+ when:
+ - ansible_os_family == "Debian"
block:
- name: check /etc/default/ceph exist
stat:
check_mode: no
- name: configure cluster name
+ when:
+ - etc_default_ceph.stat.exists
block:
- name: when /etc/default/ceph is not dir
lineinfile:
line: "CLUSTER={{ cluster }}"
when:
- etc_default_ceph.stat.isdir
- when:
- - etc_default_ceph.stat.exists
- when:
- - ansible_os_family == "Debian"
when:
- containerized_deployment|bool
-- block:
+- name: config file operations related to OSDs
+ when:
+ - inventory_hostname in groups.get(osd_group_name, [])
+ block:
- name: count number of osds for ceph-disk scenarios
set_fact:
num_osds: "{{ devices | length | int }}"
- osd_scenario == 'lvm'
- not (lvm_batch_report.stdout | from_json).changed
- when:
- - inventory_hostname in groups.get(osd_group_name, [])
-
# ceph-common
-- block:
+- name: config file operation for non-containerized scenarios
+ when:
+ - not containerized_deployment|bool
+ block:
- name: create ceph conf directory
file:
path: "/etc/ceph"
when:
- inventory_hostname in groups[mon_group_name]
- ceph_conf_local
- when:
- - not containerized_deployment|bool
-- block:
+- name: config file operations for containerized scenarios
+ when:
+ - containerized_deployment|bool
+ block:
- name: create a local fetch directory if it does not exist
file:
path: "{{ fetch_directory }}"
- restart ceph rgws
- restart ceph mgrs
- restart ceph rbdmirrors
-
- when:
- - containerized_deployment|bool
include_tasks: remove_ceph_udev_rules.yml
- name: debian based systems tasks
+ when:
+ - ansible_distribution == 'Debian'
block:
- name: include debian_prerequisites.yml
include_tasks: debian_prerequisites.yml
until: result is succeeded
tags:
with_pkg
- when:
- - ansible_distribution == 'Debian'
- name: ubuntu based systems tasks
+ when:
+ - ansible_distribution == 'Ubuntu'
+ tags:
+ with_pkg
block:
- name: install docker on ubuntu
package:
update_cache: yes
register: result
until: result is succeeded
-
- name: install python3-docker on bionic
package:
name: python3-docker
register: result
until: result is succeeded
when: ansible_lsb.codename == 'bionic'
- when:
- - ansible_distribution == 'Ubuntu'
- tags:
- with_pkg
# ensure extras enabled for docker
- name: enable extras on centos
with_pkg
- name: red hat 7 based systems tasks
+ when:
+ - ansible_os_family == 'RedHat'
+ - ansible_distribution_major_version == '7'
block:
- name: install python-docker-py on red hat / centos
package:
tags:
with_pkg
+- name: red hat 8 based systems tasks
when:
- ansible_os_family == 'RedHat'
- - ansible_distribution_major_version == '7'
-
-- name: red hat 8 based systems tasks
+ - ansible_distribution_major_version == '8'
block:
- name: install podman
package:
until: result is succeeded
tags:
with_pkg
- when:
- - ansible_os_family == 'RedHat'
- - ansible_distribution_major_version == '8'
- name: ensure tmpfiles.d is present
lineinfile:
when:
- ceph_current_status.fsid is defined
-- block:
+- name: fsid realted tasks
+ when:
+ - generate_fsid
+ - ceph_current_status.fsid is undefined
+ - not rolling_update
+ block:
- name: generate cluster fsid
shell: python -c 'import uuid; print(str(uuid.uuid4()))'
register: cluster_uuid
set_fact:
fsid: "{{ cluster_uuid.stdout }}"
- when:
- - generate_fsid
- - ceph_current_status.fsid is undefined
- - not rolling_update
-
- name: set_fact mds_name ansible_hostname
set_fact:
mds_name: "{{ ansible_hostname }}"
- radosgw_address is defined
- radosgw_address != '0.0.0.0'
-- block:
+- name: tasks for radosgw interface
+ when:
+ - radosgw_address_block == 'subnet'
+ - radosgw_address == '0.0.0.0'
+ - radosgw_interface != 'interface'
+ block:
- name: set_fact _interface
set_fact:
_interface: "{{ 'ansible_' + (radosgw_interface | replace('-', '_')) }}"
_radosgw_address: "{{ hostvars[inventory_hostname][_interface][ip_version][0]['address'] }}"
when:
- ip_version == 'ipv6'
- when:
- - radosgw_address_block == 'subnet'
- - radosgw_address == '0.0.0.0'
- - radosgw_interface != 'interface'
when:
- not containerized_deployment
-- block:
+- when:
+ - (firewalld_pkg_query.get('rc', 1) == 0
+ or is_atomic)
+ block:
- name: start firewalld
service:
name: firewalld
tags:
- firewall
- when:
- - (firewalld_pkg_query.get('rc', 1) == 0
- or is_atomic)
-
- meta: flush_handlers
---
- name: red hat based systems tasks
+ when:
+ - ansible_os_family == 'RedHat'
block:
- name: when ceph_iscsi_config_dev is true
+ when:
+ - ceph_origin == 'repository'
+ - ceph_repository == 'dev'
+ - ceph_iscsi_config_dev
block:
- name: set_fact ceph_iscsi_repos
set_fact:
with_together:
- "{{ ceph_iscsi_config_dev_yum_repo.results }}"
- "{{ ceph_iscsi_repos }}"
- when:
- - ceph_origin == 'repository'
- - ceph_repository == 'dev'
- - ceph_iscsi_config_dev
- name: install ceph iscsi package
package:
- targetcli
- python-rtslib
- ceph-iscsi-cli
- when:
- - ansible_os_family == 'RedHat'
- name: check the status of the target.service override
stat:
delay: "{{ handler_health_mon_check_delay }}"
changed_when: false
-- block:
+- name: tasks for MONs when cephx is enabled
+ when:
+ - cephx
+ block:
- name: fetch ceph initial keys
ceph_key:
state: fetch_initial_keys
with_items:
- "{{ groups.get(mon_group_name) if groups.get(mgr_group_name, []) | length == 0 else groups.get(mgr_group_name, []) }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
- when:
- - cephx
- name: copy keys to the ansible server
fetch:
- item.create|bool
- name: cephx related tasks
+ when:
+ - cephx
block:
- name: copy bootstrap cephx keys
copy:
- item.copy_key|bool
- name: nfs object gateway related tasks
+ when:
+ - nfs_obj_gw
block:
- name: create rados gateway keyring
command: ceph --cluster {{ cluster }} --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring auth get-or-create client.rgw.{{ ansible_hostname }} osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
owner: "ceph"
group: "ceph"
mode: "0600"
- when:
- - nfs_obj_gw
- when:
- - cephx
- name: change ownership on /var/log/ganesha
file:
---
- name: debian based systems - repo handling
+ when:
+ - ceph_origin == 'repository'
block:
- name: stable repos specific tasks
+ when:
+ - nfs_ganesha_stable
+ - ceph_repository == 'community'
block:
- name: add nfs-ganesha stable repository
apt_repository:
until: update_ganesha_apt_cache | success
when:
- add_ganesha_apt_repo | changed
- when:
- - nfs_ganesha_stable
- - ceph_repository == 'community'
- name: debian based systems - dev repos specific tasks
+ when:
+ - nfs_ganesha_dev
+ - ceph_repository == 'dev'
block:
- name: fetch nfs-ganesha development repository
uri:
owner: root
group: root
backup: yes
- when:
- - nfs_ganesha_dev
- - ceph_repository == 'dev'
- when:
- - ceph_origin == 'repository'
- name: debain based systems - install required packages
block:
- name: debian based systems- non-rhcs installation
+ when:
+ - (ceph_origin == 'repository' or ceph_origin == 'distro')
+ - ceph_repository != 'rhcs'
block:
- name: install jemalloc for debian
apt:
register: result
until: result is succeeded
when: nfs_file_gw
- when:
- - (ceph_origin == 'repository' or ceph_origin == 'distro')
- - ceph_repository != 'rhcs'
- name: debian based systems - rhcs installation
+ when:
+ - (ceph_origin == 'repository' or ceph_origin == 'distro')
+ - ceph_repository == 'rhcs'
block:
- name: install red hat storage nfs gateway for debian
apt:
until: result is succeeded
when:
- nfs_obj_gw
- when:
- - (ceph_origin == 'repository' or ceph_origin == 'distro')
- - ceph_repository == 'rhcs'
---
- name: red hat based systems - repo handling
+ when:
+ - ceph_origin == 'repository'
block:
- name: add nfs-ganesha stable repository
yum_repository:
when:
- nfs_ganesha_dev
- ceph_repository == 'dev'
- when:
- - ceph_origin == 'repository'
- name: red hat based systems - install nfs packages
block:
---
-- block:
- # For openstack VMs modify the mount point below depending on if the Openstack
- # VM deploy tool defaults to mounting ephemeral disks
+- name: container specific tasks
+ when:
+ - containerized_deployment
+ block:
- name: umount ceph disk (if on openstack)
mount:
name: /mnt
setype: "bin_t"
notify:
- restart ceph osds
- when:
- - containerized_deployment
# this is for ceph-disk, the ceph-disk command is gone so we have to list /var/lib/ceph
- name: get osd ids
---
- name: debian based systems tasks
+ when:
+ - osd_objectstore == 'filestore'
+ - ansible_os_family == "Debian"
block:
- name: disable osd directory parsing by updatedb
command: updatedb -e /var/lib/ceph
regexp: '^(PRUNEPATHS(?!.*/var/lib/ceph).*)"$'
replace: '\1 /var/lib/ceph"'
failed_when: false
- when:
- - osd_objectstore == 'filestore'
- - ansible_os_family == "Debian"
- name: create tmpfiles.d directory
file:
---
- name: devices validation
+ when:
+ - devices is defined
block:
- name: validate devices is actually a device
parted:
when:
- item.failed
with_items: "{{ devices_parted.results }}"
- when:
- - devices is defined
- name: validate dedicated_device is/are actually device(s)
parted:
- ansible_os_family not in ['Debian', 'RedHat', 'ClearLinux', 'Suse']
- name: red hat based systems tasks
+ when:
+ - ceph_repository == 'rhcs'
+ - ansible_distribution == 'Red Hat Enterprise Linux'
block:
- name: fail on unsupported distribution for red hat ceph storage
fail:
- ansible_distribution_version | version_compare('7.3', '<')
- name: subscription manager related tasks
+ when:
+ - ceph_repository_type == 'cdn'
block:
- name: determine if node is registered with subscription-manager
command: subscription-manager identity
msg: "You must register your machine with subscription-manager"
when:
- subscription.rc != '0'
- when:
- - ceph_repository_type == 'cdn'
- when:
- - ceph_repository == 'rhcs'
- - ansible_distribution == 'Red Hat Enterprise Linux'
- name: fail on unsupported distribution for ubuntu cloud archive
fail:
- not use_fqdn_yes_i_am_sure
- name: debian based systems tasks
+ when:
+ - ansible_os_family == 'Debian'
block:
- name: fail if local scenario is enabled on debian
fail:
- ceph_repository_type == 'cdn'
- ceph_rhcs_cdn_debian_repo == 'https://customername:customerpasswd@rhcs.download.redhat.com'
- ceph_repository not in ['rhcs', 'dev', 'obs']
- when:
- - ansible_os_family == 'Debian'
- name: validate ntp daemon type
fail: