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-ansible package on the Ansible administration node.

  • The Ansible inventory file contains the cluster and admin hosts.

Procedure

  1. Log in to the Ansible administration node.

  2. Navigate to the /usr/share/cephadm-ansible directory on the Ansible administration node:

    Example

     [ansible@admin ~]$ cd /usr/share/cephadm-ansible
  3. 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_SERVICE

    Example

     [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: mon

    In this example, the playbook starts the OSD with an ID of 0 and stops a Ceph Monitor with an id of host02.

  4. Run the playbook:

    Syntax

     ansible-playbook -i INVENTORY_FILE PLAYBOOK_FILENAME.yml

    Example

     [ansible@admin cephadm-ansible]$ ansible-playbook -i hosts restart_services.yml

Verification

  • Review the output from the playbook tasks.