Merge "Apply ceph_conf_overrides for non-deployed_ceph services"

This commit is contained in:
Zuul 2021-10-12 23:29:02 +00:00 committed by Gerrit Code Review
commit 98d7bc4ca1
8 changed files with 55 additions and 9 deletions

View File

@ -28,6 +28,13 @@
when:
- not tripleo_cephadm_deployed_ceph
- name: Apply ceph_conf_overrides on update
import_role:
name: tripleo_cephadm
tasks_from: apply_ceph_conf_overrides
when:
- tripleo_cephadm_apply_ceph_conf_overrides_on_update
- name: Apply Ceph spec
import_role:
name: tripleo_cephadm

View File

@ -17,7 +17,8 @@ tripleo_cephadm_registry_url: ''
tripleo_cephadm_keyring_prefix: "{{ tripleo_cephadm_config_home }}/{{ tripleo_cephadm_cluster }}.client"
tripleo_cephadm_admin_keyring: "{{ tripleo_cephadm_keyring_prefix }}.admin.keyring"
tripleo_cephadm_conf: "{{ tripleo_cephadm_config_home }}/{{ tripleo_cephadm_cluster }}.conf"
tripleo_cephadm_bootstrap_conf: "/home/{{ tripleo_cephadm_ssh_user }}/bootstrap_{{ tripleo_cephadm_cluster }}.conf"
tripleo_cephadm_assimilate_conf: "/home/{{ tripleo_cephadm_ssh_user }}/assimilate_{{ tripleo_cephadm_cluster }}.conf"
tripleo_cephadm_assimilate_conf_container: "/home/assimilate_{{ tripleo_cephadm_cluster }}.conf"
# path on ansible host (i.e. undercloud) of the ceph spec
tripleo_cephadm_spec_ansible_host: "{{ playbook_dir }}/ceph_spec.yaml"
# path on bootstrap node of ceph spec (scp'd from above var)
@ -65,3 +66,4 @@ tripleo_cephadm_deployed_ceph_tht_path: "/home/stack/deployed_ceph.yaml"
tripleo_cephadm_backend: ''
tripleo_cephadm_action: disable
tripleo_cephadm_rbd_trash_interval: 15
tripleo_cephadm_apply_ceph_conf_overrides_on_update: false

View File

@ -25,15 +25,15 @@
- name: Stat pre ceph conf file
stat:
path: "{{ tripleo_cephadm_bootstrap_conf }}"
register: tripleo_cephadm_bootstrap_conf_stat
path: "{{ tripleo_cephadm_assimilate_conf }}"
register: tripleo_cephadm_assimilate_conf_stat
become: true
- name: Fail if pre ceph conf file is missing
fail:
msg: "{{ tripleo_cephadm_bootstrap_conf }} does not exist according to stat"
msg: "{{ tripleo_cephadm_assimilate_conf }} does not exist according to stat"
when:
- tripleo_cephadm_bootstrap_conf_stat.stat.exists is not defined
- tripleo_cephadm_assimilate_conf_stat.stat.exists is not defined
- name: Stat spec file on bootstrap node
stat:

View File

@ -0,0 +1,29 @@
---
# 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: Ensure tripleo_cephadm_ceph_cli is set
include_tasks: ceph_cli.yaml
when:
- tripleo_cephadm_ceph_cli is not defined
# pre.yml populated tripleo_cephadm_assimilate_conf with the latest config
- name: Assimilate configuration from tripleo_cephadm_assimilate_conf
command: |
{{ tripleo_cephadm_ceph_cli }} config assimilate-conf
-i {{ tripleo_cephadm_assimilate_conf_container }}
changed_when: false
become: true

View File

@ -34,8 +34,8 @@
- name: Stat pre ceph conf file in case we should bootrap with it
stat:
path: "{{ tripleo_cephadm_bootstrap_conf }}"
register: tripleo_cephadm_bootstrap_conf_stat
path: "{{ tripleo_cephadm_assimilate_conf }}"
register: tripleo_cephadm_assimilate_conf_stat
become: true
# cephadm_ls should be registered by pre.yaml
@ -59,7 +59,7 @@
{% 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_bootstrap_conf_stat.stat.exists %}--config {{ tripleo_cephadm_bootstrap_conf }} \{% endif %}
{% if tripleo_cephadm_assimilate_conf_stat.stat.exists %}--config {{ tripleo_cephadm_assimilate_conf }} \{% endif %}
--skip-monitoring-stack --skip-dashboard \
--mon-ip {{ tripleo_cephadm_first_mon_ip }}
register: cephadm_bootstrap
@ -69,6 +69,7 @@
msg: "{{ cephadm_bootstrap }}"
when: tripleo_cephadm_verbose
when:
- cephadm_ls is defined
- cephadm_ls.stdout == '[]'
tags:
- cephadm_bootstrap
@ -79,4 +80,5 @@
'cephadm bootstrap' was not run because 'cephadm ls'
indicates that Ceph containers are already running.
when:
- cephadm_ls is defined
- cephadm_ls.stdout != '[]'

View File

@ -25,6 +25,7 @@
--interactive
{% endif %}
--volume {{ tripleo_cephadm_config_home }}:/etc/ceph:z
--volume {{ tripleo_cephadm_assimilate_conf }}:{{ tripleo_cephadm_assimilate_conf_container }}:z
{% if mount_spec|default(false) %}
--volume {{ tripleo_cephadm_spec }}:{{ tripleo_cephadm_container_spec }}:z
{% endif %}

View File

@ -38,6 +38,8 @@
shell: "{{ tripleo_cephadm_bin }} ls --no-detail"
register: cephadm_ls
become: true
tags:
- cephadm_bootstrap
- name: Ensure tripleo_cephadm_fsid variable is set if none was provided
block:
@ -45,6 +47,7 @@
set_fact:
tripleo_cephadm_fsid_list: "{{ cephadm_ls.stdout | from_json | map(attribute='fsid') | sort | unique }}"
when:
- cephadm_ls is defined
- cephadm_ls.stdout is defined
- cephadm_ls.stdout != '[]'
- name: Fail if >1 FSID was discovered
@ -104,7 +107,7 @@
action: config_template
args:
src: "ceph.conf.j2"
dest: "{{ tripleo_cephadm_bootstrap_conf }}"
dest: "{{ tripleo_cephadm_assimilate_conf }}"
owner: "{{ tripleo_cephadm_uid }}"
group: "{{ tripleo_cephadm_uid }}"
mode: "0644"

View File

@ -3,3 +3,5 @@ parameter_defaults:
CephClusterFSID: {{ tripleo_cephadm_fsid }}
CephDynamicSpec: false
DeployedCeph: true
# Recommendation: set the following to false after overcloud is deployed
ApplyCephConfigOverridesOnUpdate: true