Mohammed Naser | fef6942 | 2023-01-18 02:38:06 +0000 | [diff] [blame] | 1 | # Copyright (c) 2022 VEXXHOST, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
Mohammed Naser | 3595fdd | 2023-03-08 18:38:55 +0000 | [diff] [blame] | 15 | - name: Verify state of current RabbitMQ cluster |
| 16 | kubernetes.core.k8s_info: |
| 17 | api_version: rabbitmq.com/v1beta1 |
| 18 | kind: RabbitmqCluster |
| 19 | name: "rabbitmq-{{ rabbitmq_cluster_name }}" |
| 20 | namespace: openstack |
| 21 | register: _rabbitmq_cluster |
| 22 | |
| 23 | - name: Wait for confirmation if RabbitMQ cluster spec doesn't match |
| 24 | when: |
| 25 | - not rabbitmq_skip_spec_diff | bool |
| 26 | - _rabbitmq_cluster.resources | length > 0 |
| 27 | - _rabbitmq_cluster.resources[0].spec != _rabbitmq_merged_spec |
| 28 | vars: |
| 29 | _rabbitmq_merged_spec: "{{ _rabbitmq_spec | combine(rabbitmq_spec, recursive=True) }}" |
| 30 | block: |
| 31 | - name: Print diff of RabbitMQ cluster spec |
| 32 | ansible.utils.fact_diff: |
| 33 | before: "{{ _rabbitmq_cluster.resources[0].spec }}" |
| 34 | after: "{{ _rabbitmq_merged_spec }}" |
| 35 | |
| 36 | - name: Wait for confirmation of RabbitMQ cluster spec |
| 37 | ansible.builtin.pause: |
| 38 | |
Mohammed Naser | fef6942 | 2023-01-18 02:38:06 +0000 | [diff] [blame] | 39 | - name: Deploy cluster |
| 40 | kubernetes.core.k8s: |
| 41 | state: present |
| 42 | definition: |
| 43 | apiVersion: rabbitmq.com/v1beta1 |
| 44 | kind: RabbitmqCluster |
| 45 | metadata: |
| 46 | name: "rabbitmq-{{ rabbitmq_cluster_name }}" |
| 47 | namespace: openstack |
Mohammed Naser | 3595fdd | 2023-03-08 18:38:55 +0000 | [diff] [blame] | 48 | spec: "{{ _rabbitmq_spec | combine(rabbitmq_spec, recursive=True) }}" |
Mohammed Naser | fef6942 | 2023-01-18 02:38:06 +0000 | [diff] [blame] | 49 | wait: true |
| 50 | wait_timeout: 600 |
| 51 | wait_condition: |
| 52 | type: ClusterAvailable |
| 53 | status: "True" |