Files
openstack-ansible-os_trove/tasks/trove_resources.yml
Dmitriy Rabotyagov 3035e25333 Add support for generation of SSH keypairs
If operator needs to enter guest agent instance for troubleshooting,
they need to create a keypair, upload it as Trove user specifically,
create a security group and define it's UUID in trove.conf

This process is quite cumbersome and time consuming, thus this
patch implements mentioned fuctionality and can be enabled
with a single variable.

Process is alike to what we have and been using for Octavia for a while.

Change-Id: I29984c565c808bca79ef39a02e79d9b015a70786
2025-06-04 11:53:50 +00:00

68 lines
3.2 KiB
YAML

---
# Copyright 2024, 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: Set up the service network
ansible.builtin.include_role:
name: openstack.osa.openstack_resources
vars:
openstack_resources_setup_host: "{{ trove_service_setup_host }}"
openstack_resources_python_interpreter: "{{ trove_service_setup_host_python_interpreter }}"
openstack_resources_deploy_host: "{{ trove_resources_deploy_host }}"
openstack_resources_deploy_python_interpreter: "{{ trove_resources_deploy_python_interpreter }}"
_keypairs:
- name: "{{ trove_guest_ssh_key_name }}"
path: "{{ trove_guest_ssh_key_dir }}/{{ trove_guest_ssh_key_name }}"
state: "{{ (trove_guest_ssh_enabled | bool) | ternary('present', 'absent') }}"
private_key_format: "{{ trove_guest_ssh_key_format }}"
size: "{{ trove_guest_ssh_key_size }}"
comment: "{{ trove_guest_ssh_key_comment }}"
type: "{{ trove_guest_ssh_key_type }}"
auth:
auth_url: "{{ keystone_service_adminurl }}"
username: "{{ trove_service_user_name }}"
password: "{{ trove_service_password }}"
project_name: "{{ trove_service_project_name }}"
user_domain_name: "{{ trove_service_user_domain_id }}"
project_domain_name: "{{ trove_service_project_domain_id }}"
_network_resources:
- name: "{{ trove_service_net_name }}"
network_type: "{{ trove_service_net_type }}"
physical_network: "{{ trove_service_net_phys_net }}"
segmentation_id: "{{ trove_service_net_segmentation_id | default(omit) }}"
project: "admin"
subnets:
- name: "{{ trove_service_subnet_name }}"
cidr: "{{ trove_service_net_subnet_cidr }}"
dhcp: "{{ trove_service_net_dhcp }}"
allocation_start: "{{ trove_service_net_allocation_pool_start | default(omit) }}"
allocation_end: "{{ trove_service_net_allocation_pool_end | default(omit) }}"
_security_groups:
- name: "{{ trove_guest_ssh_security_group_name }}"
description: "security group for octavia amphora"
project: "{{ trove_service_project_name }}"
security_group_rules:
- protocol: tcp
port_range_min: 22
port_range_max: 22
remote_ip_prefix: "{{ trove_service_net_subnet_cidr }}"
openstack_resources_network:
networks: "{{ trove_service_net_setup | ternary(_network_resources, []) }}"
security_groups: "{{ (trove_guest_ssh_enabled) | ternary(_security_groups + trove_guest_ssh_security_group_extra_rules, []) }}"
openstack_resources_image:
images: "{{ _trove_glance_images_compat }}"
openstack_resources_compute:
keypairs: "{{ (trove_guest_ssh_key_manage | bool) | ternary(_keypairs, {}) }}"