87 lines
3.7 KiB
YAML
87 lines
3.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: Add spec to necessary file list when using spec to bootstrap
|
|
set_fact:
|
|
tripleo_cephadm_bootstrap_files: "{{ tripleo_cephadm_bootstrap_files + [ tripleo_cephadm_spec ] }}"
|
|
when: tripleo_cephadm_spec_on_bootstrap | bool
|
|
|
|
- name: Stat necessary files to bootstrap with cephadm
|
|
stat:
|
|
path: "{{ item }}"
|
|
register: tripleo_cephadm_bootstrap_files_stat
|
|
become: true
|
|
loop: "{{ tripleo_cephadm_bootstrap_files }}"
|
|
|
|
- name: Fail if necessary files are missing
|
|
fail:
|
|
msg: "{{ item.invocation.module_args.path }} does not exist"
|
|
loop: "{{ tripleo_cephadm_bootstrap_files_stat.results | list }}"
|
|
when: not item.stat.exists
|
|
|
|
- name: Stat pre ceph conf file in case we should bootrap with it
|
|
stat:
|
|
path: "{{ tripleo_cephadm_assimilate_conf }}"
|
|
register: tripleo_cephadm_assimilate_conf_stat
|
|
become: true
|
|
|
|
# cephadm_ls should be registered by pre.yaml
|
|
|
|
- name: Bootstrap Ceph if there are no running Ceph Daemons
|
|
block:
|
|
- name: Run cephadm bootstrap
|
|
shell: |
|
|
{{ tripleo_cephadm_bin }} \
|
|
{% if not tripleo_cephadm_default_container %}--image {{ tripleo_cephadm_container_ns + '/' + tripleo_cephadm_container_image + ':' + tripleo_cephadm_container_tag|string }} \{% endif %}
|
|
bootstrap \
|
|
--skip-firewalld \
|
|
--ssh-private-key /home/{{ tripleo_cephadm_ssh_user }}/.ssh/id_rsa \
|
|
--ssh-public-key /home/{{ tripleo_cephadm_ssh_user }}/.ssh/id_rsa.pub \
|
|
--ssh-user {{ tripleo_cephadm_ssh_user }} \
|
|
--allow-fqdn-hostname \
|
|
--output-keyring {{ tripleo_cephadm_admin_keyring }} \
|
|
--output-config {{ tripleo_cephadm_conf }} \
|
|
--fsid {{ tripleo_cephadm_fsid }} \
|
|
{% if tripleo_cephadm_registry_url|length > 0 %}--registry-url {{ tripleo_cephadm_registry_url }} \{% endif %}
|
|
{% if tripleo_cephadm_registry_username|length > 0 %}--registry-username {{ tripleo_cephadm_registry_username }} \{% endif %}
|
|
{% if tripleo_cephadm_registry_password|length > 0 %}--registry-password {{ tripleo_cephadm_registry_password }} \{% endif %}
|
|
{% if tripleo_cephadm_spec_on_bootstrap %}--apply-spec {{ tripleo_cephadm_spec }} \{% endif %}
|
|
{% if tripleo_cephadm_assimilate_conf_stat.stat.exists %}--config {{ tripleo_cephadm_assimilate_conf }} \{% endif %}
|
|
{% if tripleo_cephadm_single_host_defaults %}--single-host-defaults \{% endif %}
|
|
--skip-monitoring-stack --skip-dashboard \
|
|
{% if tripleo_cephadm_extra_args|length > 0 %}{{ tripleo_cephadm_extra_args }} \{% endif %}
|
|
--mon-ip {{ tripleo_cephadm_first_mon_ip }}
|
|
register: cephadm_bootstrap
|
|
become: true
|
|
- name: Show results of bootstrap
|
|
debug:
|
|
msg: "{{ cephadm_bootstrap }}"
|
|
when: tripleo_cephadm_verbose | bool
|
|
when:
|
|
- cephadm_ls is defined
|
|
- cephadm_ls.stdout == '[]'
|
|
tags:
|
|
- cephadm_bootstrap
|
|
|
|
- name: If cephadm bootstrap was not run report the reason
|
|
debug:
|
|
msg: |
|
|
'cephadm bootstrap' was not run because 'cephadm ls'
|
|
indicates that Ceph containers are already running.
|
|
when:
|
|
- cephadm_ls is defined
|
|
- cephadm_ls.stdout != '[]'
|