tripleo-ansible/tripleo_ansible/roles/tripleo_cephadm/tasks/apply_spec.yaml

56 lines
1.7 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: Stat spec file on bootstrap node
stat:
path: "{{ item }}"
register: tripleo_cephadm_spec_files_stat
become: true
loop:
- "{{ tripleo_cephadm_spec }}"
- name: Fail if spec file is missing
fail:
msg: "{{ item.invocation.module_args.path }} does not exist"
loop: "{{ tripleo_cephadm_spec_files_stat.results | list }}"
when: not item.stat.exists
- name: Get ceph_cli
include_tasks: ceph_cli.yaml
vars:
mount_spec: true
- name: Get the ceph orchestrator status
command: "{{ tripleo_cephadm_ceph_cli }} orch status --format json"
register: ceph_orch_status
become: true
- name: Fail if ceph orchestrator is not available
fail:
msg: "'ceph orch status' returned {{ ceph_orch_status.stdout | from_json }}"
when:
- not (ceph_orch_status.stdout | from_json).available
- name: Apply spec
command: "{{ tripleo_cephadm_ceph_cli }} orch apply --in-file {{ tripleo_cephadm_container_spec }}"
register: tripleo_cephadm_apply_spec_out
become: true
- name: Show results of spec apply
debug:
msg: "{{ tripleo_cephadm_apply_spec_out }}"
when: tripleo_cephadm_verbose