tripleo-ansible/tripleo_ansible/roles/tripleo_cephadm/tasks/toggle_cephadm.yml

44 lines
1.5 KiB
YAML

---
# Copyright 2021 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Fail if FSID is missing
fail:
msg: "The Ceph FSID is required to use the Ceph CLI in admin mode"
when:
- (tripleo_cephadm_fsid is not defined) or
(tripleo_cephadm_fsid | length < 1)
- name: Get ceph_cli
include_tasks: ceph_cli.yaml
- name: Set tripleo_cephadm_toggle_cmds
set_fact:
tripleo_cephadm_toggle_cmds:
- "{{ tripleo_cephadm_ceph_cli }} orch set backend {{ tripleo_cephadm_backend|default('') }}"
- "{{ tripleo_cephadm_ceph_cli }} mgr module {{ tripleo_cephadm_action|default('disable') }} cephadm"
- name: Reverse the toggle command order when enabling
set_fact:
tripleo_cephadm_toggle_cmds: "{{ tripleo_cephadm_toggle_cmds | reverse | list }}"
when:
- tripleo_cephadm_action == 'enable'
- name: Toggle Ceph
command: "{{ item }}"
changed_when: false
become: true
loop: "{{ tripleo_cephadm_toggle_cmds }}"