Skip to content

Commit 46d6a07

Browse files
committed
Fix SSL cert mismatch when re-running install_stack
When install_stack is re-run on an already-deployed system, the simpleca role generates a new CA in a temp directory (always fresh), and the new CA cert overwrites /etc/pki/ca-trust/source/anchors/simpleca.crt. But the TripleO deploy is skipped (clouds.yaml already exists), so the running services still serve the old server cert signed by the old CA. This breaks all openstack CLI calls with CERTIFICATE_VERIFY_FAILED. Fix by moving the tripleo_deployed check before the SSL generation blocks and guarding them with 'not tripleo_deployed.stat.exists', so we only generate and install new certs when actually deploying.
1 parent af575ad commit 46d6a07

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

playbooks/install_stack.yaml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@
6262
- /opt/exported-data/extra-host-file-entries.json
6363
- /opt/exported-data/all-nodes-extra-map-data.json
6464

65+
- name: Check if TripleO has already been deployed
66+
ansible.builtin.stat:
67+
path: /etc/openstack/clouds.yaml
68+
register: tripleo_deployed
69+
become: true
70+
become_user: root
71+
6572
- name: Enable SSL
6673
when: ssl_enabled
6774
block:
@@ -75,7 +82,9 @@
7582
- /usr/share/openstack-tripleo-heat-templates/environments/ssl/inject-trust-anchor.yaml
7683

7784
- name: Generate SSL self-signed certificate on localhost
78-
when: ssl_enabled
85+
when:
86+
- ssl_enabled
87+
- not tripleo_deployed.stat.exists
7988
become: false
8089
# We run this block on localhost because we don't want to put the CA key on the remote
8190
# server, which could lead to security problems.
@@ -96,7 +105,9 @@
96105
cert_name: standalone
97106

98107
- name: Prepare the host for SSL
99-
when: ssl_enabled
108+
when:
109+
- ssl_enabled
110+
- not tripleo_deployed.stat.exists
100111
no_log: true
101112
block:
102113
- name: Read and clean SSL files
@@ -307,6 +318,7 @@
307318
neutron_bridge_mappings: "{{ base_bridge_mappings }}"
308319

309320
- name: Create standalone_parameters.yaml
321+
when: not tripleo_deployed.stat.exists
310322
no_log: true
311323
ansible.builtin.template:
312324
mode: '644'
@@ -506,13 +518,6 @@
506518
when:
507519
- ceph_enabled
508520

509-
- name: Check if TripleO has already been deployed
510-
ansible.builtin.stat:
511-
path: /etc/openstack/clouds.yaml
512-
register: tripleo_deployed
513-
become: true
514-
become_user: root
515-
516521
- name: Clean up stale heat processes from previous deploy
517522
become: true
518523
become_user: root
@@ -530,6 +535,7 @@
530535
# causes API requests to be randomly routed to the wrong instance,
531536
# resulting in 'Stack create failed'.
532537
ansible.builtin.command: pkill -9 -f heat-all
538+
changed_when: true
533539
when: heat_running.rc == 0
534540

535541
- name: Wait for heat processes to terminate

0 commit comments

Comments
 (0)