|
62 | 62 | - /opt/exported-data/extra-host-file-entries.json |
63 | 63 | - /opt/exported-data/all-nodes-extra-map-data.json |
64 | 64 |
|
| 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 | + |
65 | 72 | - name: Enable SSL |
66 | 73 | when: ssl_enabled |
67 | 74 | block: |
|
75 | 82 | - /usr/share/openstack-tripleo-heat-templates/environments/ssl/inject-trust-anchor.yaml |
76 | 83 |
|
77 | 84 | - name: Generate SSL self-signed certificate on localhost |
78 | | - when: ssl_enabled |
| 85 | + when: |
| 86 | + - ssl_enabled |
| 87 | + - not tripleo_deployed.stat.exists |
79 | 88 | become: false |
80 | 89 | # We run this block on localhost because we don't want to put the CA key on the remote |
81 | 90 | # server, which could lead to security problems. |
|
96 | 105 | cert_name: standalone |
97 | 106 |
|
98 | 107 | - name: Prepare the host for SSL |
99 | | - when: ssl_enabled |
| 108 | + when: |
| 109 | + - ssl_enabled |
| 110 | + - not tripleo_deployed.stat.exists |
100 | 111 | no_log: true |
101 | 112 | block: |
102 | 113 | - name: Read and clean SSL files |
|
307 | 318 | neutron_bridge_mappings: "{{ base_bridge_mappings }}" |
308 | 319 |
|
309 | 320 | - name: Create standalone_parameters.yaml |
| 321 | + when: not tripleo_deployed.stat.exists |
310 | 322 | no_log: true |
311 | 323 | ansible.builtin.template: |
312 | 324 | mode: '644' |
|
506 | 518 | when: |
507 | 519 | - ceph_enabled |
508 | 520 |
|
| 521 | + - name: Clean up stale heat processes from previous deploy |
| 522 | + become: true |
| 523 | + become_user: root |
| 524 | + when: not tripleo_deployed.stat.exists |
| 525 | + block: |
| 526 | + - name: Check if heat-all is already running (previous deploy with --keep-running) |
| 527 | + ansible.builtin.command: pgrep -f heat-all |
| 528 | + register: heat_running |
| 529 | + failed_when: false |
| 530 | + changed_when: false |
| 531 | + |
| 532 | + - name: Kill stale heat-all processes |
| 533 | + # Each tripleo deploy forks a new heat-all without killing old ones. |
| 534 | + # Multiple heat-all processes sharing port 8006 via SO_REUSEPORT |
| 535 | + # causes API requests to be randomly routed to the wrong instance, |
| 536 | + # resulting in 'Stack create failed'. |
| 537 | + ansible.builtin.command: pkill -9 -f heat-all |
| 538 | + changed_when: true |
| 539 | + when: heat_running.rc == 0 |
| 540 | + |
| 541 | + - name: Wait for heat processes to terminate |
| 542 | + ansible.builtin.command: pgrep -f heat-all |
| 543 | + register: heat_check |
| 544 | + failed_when: false |
| 545 | + changed_when: false |
| 546 | + retries: 10 |
| 547 | + delay: 1 |
| 548 | + until: heat_check.rc != 0 |
| 549 | + |
| 550 | + - name: Remove stack update mark to ensure a clean stack create |
| 551 | + ansible.builtin.file: |
| 552 | + path: /var/lib/tripleo-heat-installer/update_mark_standalone |
| 553 | + state: absent |
| 554 | + |
509 | 555 | - name: Run TripleO deploy |
| 556 | + when: not tripleo_deployed.stat.exists |
510 | 557 | ansible.builtin.import_role: |
511 | 558 | name: tripleo.operator.tripleo_deploy |
512 | 559 | vars: |
|
0 commit comments