Applying a service specification
As a storage administrator, you can apply service specifications to your storage cluster using the ceph_orch_apply module in your Ansible playbooks.
A service specification is a data structure to specify the service attributes and configuration settings that is used to deploy the Ceph service. You can use a service specification to deploy Ceph service types like mon, crash, mds, mgr, osd, rdb, or rbd-mirror.
For more information about service specification options, see ../operations/operations-main.html.
Prerequisites
- A running IBM Storage Ceph cluster.
- Ansible user with sudo and passwordless SSH access to all nodes in the storage cluster.
- Installation of the
cephadm-ansiblepackage on the Ansible administration node. - The Ansible inventory file contains the cluster and admin hosts.
Procedure
- Log in to the Ansible administration node.
-
Navigate to the
/usr/share/cephadm-ansibledirectory on the Ansible administration node:Example
[ansible@admin ~]$ cd /usr/share/cephadm-ansible - Create a playbook with the service specifications.
sudo vi PLAYBOOK_FILENAME.yml --- - name: PLAY_NAME hosts: HOSTS_OR_HOST_GROUPS become: USE_ELEVATED_PRIVILEGES gather_facts: GATHER_FACTS_ABOUT_REMOTE_HOSTS tasks: - name: NAME_OF_TASK ceph_orch_apply: spec: | service_type: SERVICE_TYPE service_id: UNIQUE_NAME_OF_SERVICE placement: host_pattern: HOST_PATTERN_TO_SELECT_HOSTS label: LABEL spec: SPECIFICATION_OPTIONS:Example
[ansible@admin cephadm-ansible]$ sudo vi deploy_osd_service.yml --- - name: deploy osd service hosts: host01 become: true gather_facts: true tasks: - name: apply osd spec ceph_orch_apply: spec: | service_type: osd service_id: osd placement: host_pattern: '*' label: osd spec: data_devices: all: trueIn this example, the playbook deploys the Ceph OSD service on all hosts with the label
osd. - Run the playbook.
ansible-playbook -i INVENTORY_FILE PLAYBOOK_FILENAME.ymlExample
[ansible@admin cephadm-ansible]$ ansible-playbook -i hosts deploy_osd_service.yml
Verification
- Review the output from the playbook tasks.