Managing Ceph daemon states
As a storage administrator, you can start, stop, and restart Ceph daemons on hosts using
the ceph_orch_daemon module in your Ansible playbooks.
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 daemon state changes:
Syntax
sudo vi PLAYBOOK_FILENAME.yml --- - name: PLAY_NAME hosts: ADMIN_HOST become: USE_ELEVATED_PRIVILEGES gather_facts: GATHER_FACTS_ABOUT_REMOTE_HOSTS tasks: - name: NAME_OF_TASK ceph_orch_daemon: state: STATE_OF_SERVICE daemon_id: DAEMON_ID daemon_type: TYPE_OF_SERVICEExample
[ansible@admin cephadm-ansible]$ sudo vi restart_services.yml --- - name: start and stop services hosts: host01 become: true gather_facts: false tasks: - name: start osd.0 ceph_orch_daemon: state: started daemon_id: 0 daemon_type: osd - name: stop mon.host02 ceph_orch_daemon: state: stopped daemon_id: host02 daemon_type: monIn this example, the playbook starts the OSD with an ID of
0and stops a Ceph Monitor with an id ofhost02. -
Run the playbook:
Syntax
ansible-playbook -i INVENTORY_FILE PLAYBOOK_FILENAME.ymlExample
[ansible@admin cephadm-ansible]$ ansible-playbook -i hosts restart_services.yml
Verification
-
Review the output from the playbook tasks.