def retrieve_current_spec(module: AnsibleModule, expected_spec: Dict) -> Dict:
    """ retrieve current config of the service """
    service: str = expected_spec["service_type"]
    cmd = build_base_cmd(module)
    cluster = module.params.get('cluster')
    if cluster != 'ceph':
        conf_path = f"/etc/ceph/{cluster}.conf"
        keyring_path = f"/etc/ceph/{cluster}.client.admin.keyring"
        cmd.extend(['--config', conf_path, '--keyring', keyring_path])
    cmd.extend(['ceph', 'orch', 'ls', service])
    if 'service_name' in expected_spec:
        cmd.extend([expected_spec["service_name"]])
    else:
        cmd.extend([expected_spec["service_type"] + "." + expected_spec["service_id"]])
    cmd.extend(['--format=yaml'])
    out = module.run_command(cmd)
    if isinstance(out, str):
        # if there is no existing service, cephadm returns the string 'No services reported'
        return {}
    else:
        return yaml.safe_load(out[1])
 retrieve current config of the service 
library/ceph_orch_apply.py