Files
Dmitriy Rabotyagov 15f0a8913d Make flavor_id optional for coe templates
This also adds keys to supply master_flavor_id to cluster creation, as
this might be reuqired if flavor is not supplied for template

Change-Id: Iabbbd2b8366ea693c78d3845f0cb55413b0da125
2024-05-02 11:45:36 +02:00

47 lines
2.0 KiB
YAML

---
# Copyright 2023, Cleura AB.
#
# 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: Creating coe cluster with template {{ template['name'] }}
openstack.cloud.coe_cluster:
cloud: "{{ openstack_resources_cloud_name }}"
interface: "{{ openstack_resources_interface }}"
name: "{{ cluster['name'] }}"
cluster_template_id: "{{ template_uuid }}"
state: "{{ cluster['state'] | default('present') }}"
discovery_url: "{{ cluster['discovery_url'] | default(omit) }}"
flavor_id: "{{ cluster['flavor_id'] | default(omit) }}"
floating_ip_enabled: "{{ cluster['is_floating_ip_enabled'] | default(omit) }}"
keypair: "{{ cluster['keypair'] | default(omit) }}"
labels: "{{ cluster['labels'] | default(omit) }}"
master_count: "{{ cluster['master_count'] | default(omit) }}"
master_flavor_id: "{{ cluster['master_flavor_id'] | default(omit) }}"
node_count: "{{ cluster['node_count'] | default(omit) }}"
timeout: "{{ cluster['timeout'] | default(omit) }}"
wait: "{{ cluster['wait'] | default(false) }}"
loop: "{{ template['clusters'] }}"
loop_control:
loop_var: "cluster"
label: "{{ loop_label | to_json }}"
vars:
template_uuid: >-
{{ _coe_cluster_templates['results'] | selectattr(
'cluster_template.name', 'eq', template['name']) | map(attribute='cluster_template.id') | list | first
}}
loop_label:
name: "{{ cluster['name'] }}"
template: "{{ template['name'] }}"
template_id: "{{ template_uuid }}"
state: "{{ cluster['state'] | default('present') }}"