Files
Andrew Bonney be620d3b35 Enable use of alternative host for keypair generation and storage
Keypair generation is moved to the host running Ansible
(ie. the deploy host) by default in order to match previous
behaviour. This ensures that a copy of any keypairs remains
on the deploy host as opposed to a potentially ephemeral
container.

This behaviour can be overridden using the added deploy host
and python interpreter variables.

Change-Id: I73fef0f69ddffb779eb0d70f22568558aa473a68
2024-06-27 10:29:42 +01:00

52 lines
1.8 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: Ensure host aggregate exists in nova
openstack.cloud.host_aggregate:
cloud: "{{ openstack_resources_cloud_name }}"
interface: "{{ openstack_resources_interface }}"
name: "{{ aggregate.name }}"
metadata: "{{ aggregate.metadata | default(omit) }}"
availability_zone: "{{ aggregate.availability_zone | default(omit) }}"
hosts: "{{ aggregate.hosts | default(omit) }}"
purge_hosts: "{{ aggregate.exclusive | default(omit) }}"
state: "{{ aggregate.state | default('present') }}"
loop: "{{ openstack_resources_compute['aggregates'] | default([]) }}"
loop_control:
loop_var: aggregate
vars:
ansible_python_interpreter: "{{ openstack_resources_python_interpreter }}"
- name: Iterating over set of required flavors
ansible.builtin.include_tasks:
file: compute_flavors.yml
loop: "{{ openstack_resources_compute['flavors'] | default([]) }}"
loop_control:
loop_var: flavor
vars:
ansible_python_interpreter: "{{ openstack_resources_python_interpreter }}"
- name: Create and upload keypairs
ansible.builtin.include_tasks:
file: keypairs.yml
apply:
tags:
- compute-keypairs
loop: "{{ openstack_resources_compute['keypairs'] | default([]) }}"
loop_control:
loop_var: keypair
tags:
- compute-keypairs