Skip to content

Commit 66e35d8

Browse files
committed
Make adding internal TLS config to globals.yml idempotent
Previously the internal TLS config in globals-tls-config.yml was always appended to Kolla Ansible's globals.yml. This could result in duplicated variables. This change only appends the config when it is not already present in globals.yml. This also makes it possible to add the internal TLS config permanently within globals.yml, behind a conditional.
1 parent 9366435 commit 66e35d8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ansible/files/multinode.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ function generate_overcloud_certs() {
155155
# NOTE: Previously it was necessary to first deploy HAProxy with TLS disabled.
156156
if [[ -f $KAYOBE_CONFIG_PATH/environments/$KAYOBE_ENVIRONMENT/kolla/globals-tls-config.yml ]]; then
157157
sed -i 's/# kolla_enable_tls_internal: true/kolla_enable_tls_internal: true/g' $KAYOBE_CONFIG_PATH/environments/$KAYOBE_ENVIRONMENT/kolla.yml
158-
cat $KAYOBE_CONFIG_PATH/environments/$KAYOBE_ENVIRONMENT/kolla/globals-tls-config.yml >> $KAYOBE_CONFIG_PATH/environments/$KAYOBE_ENVIRONMENT/kolla/globals.yml
158+
# This condition provides some level of idempotency, as well as supporting
159+
# the case where the content of globals-tls-config.yml has been added to
160+
# globals.yml within a conditional check for internal TLS.
161+
if ! grep kolla_copy_ca_into_containers $KAYOBE_CONFIG_PATH/environments/$KAYOBE_ENVIRONMENT/kolla/globals-tls-config.yml &>/dev/null; then
162+
cat $KAYOBE_CONFIG_PATH/environments/$KAYOBE_ENVIRONMENT/kolla/globals-tls-config.yml >> $KAYOBE_CONFIG_PATH/environments/$KAYOBE_ENVIRONMENT/kolla/globals.yml
163+
fi
159164
fi
160165
}
161166

0 commit comments

Comments
 (0)