Allow to manage extra services, mounts and networks

We do mainatain set of systemd roles, that allow to easily provision
extra services, mounts or even networks and used quite widely across
roles. This way we can ease lives of deployers and need of maintaining
external playbooks and roles that will do basically same. Feature for a
way to create/manage internal networking was also asked for quite
a while amoung users. Systemd-service role can also be used to
define post/pre hooks for configured networks and systemd_mount
can be usefull to setup a shared filesystems for image or volume
conversion directories to avoid running out of diskspace on controllers.

Change-Id: Ia13f7747696db5b7b7640df7532c6d55627bdd01
This commit is contained in:
Dmitriy Rabotyagov 2022-12-25 13:31:43 +01:00 committed by Dmitriy Rabotyagov
parent 4d28a46f08
commit 4d68d23f51
4 changed files with 88 additions and 1 deletions

View File

@ -192,4 +192,14 @@ openstack_hosts_package_manager_extra_conf: ''
openstack_hosts_apt_pinned_packages:
- package: "src:ceph"
origin: "ubuntu-cloud.archive.canonical.com"
priority: 400
priority: 400
# Define extra systemd services/networks/mounts
openstack_hosts_systemd_mounts: []
# Systemd networks can be configured only on bare metal hosts
# systemd-networkd role won't run inside containers.
openstack_hosts_systemd_networkd_devices: []
openstack_hosts_systemd_networkd_networks: []
openstack_hosts_systemd_networkd_prefix: openstack-net
openstack_hosts_systemd_services: []
openstack_hosts_systemd_slice: "openstack-hosts"

View File

@ -0,0 +1,23 @@
---
prelude: >
It is now possible to create and manage third-party services,
mount points and networks on hosts managed by OpenStack-Ansible.
This also inlcudes networks, that are required for OpenStack-Ansible
installation, like br-mgmt or br-storage.
In order to configure specific resources on selected set of hosts,
usage of group_vars or host_vars is appreciated.
features:
- |
Added new varaibles that allow users to configure extra systemd
services, networks or mounts on openstack hosts. While services and
mounts can be configured on any targeted hosts, networks will be created
only on bare metal nodes. In order to configure extra networks in
containers please reffer to ``openstack_user_config.yml`` documentation.
A list of new variables that were added:
* openstack_hosts_systemd_mounts
* openstack_hosts_systemd_networkd_devices
* openstack_hosts_systemd_networkd_networks
* openstack_hosts_systemd_networkd_prefix
* openstack_hosts_systemd_services
* openstack_hosts_systemd_slice

View File

@ -163,3 +163,13 @@
tags:
- openstack_hosts-config
when: ansible_facts['hostname'] != 'aio1'
- include_tasks: openstack_hosts_systemd.yml
args:
apply:
tags:
- openstack_hosts-config
- openstack_hosts-systemd
when: openstack_hosts_systemd_networkd_devices or openstack_hosts_systemd_networkd_networks or openstack_hosts_systemd_services or openstack_hosts_systemd_mounts
tags:
- always

View File

@ -0,0 +1,44 @@
---
# Copyright 2022, 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: Run the systemd-networkd role
include_role:
name: systemd_networkd
vars:
systemd_networkd_prefix: "{{ openstack_hosts_systemd_networkd_prefix }}"
systemd_run_networkd: true
systemd_netdevs: "{{ openstack_hosts_systemd_networkd_devices }}"
systemd_networks: "{{ openstack_hosts_systemd_networkd_networks }}"
when:
- openstack_hosts_systemd_networkd_devices
- openstack_hosts_systemd_networkd_networks
- is_metal
- name: Run the systemd-service role
include_role:
name: systemd_service
vars:
systemd_slice_name: "{{ openstack_hosts_systemd_slice }}"
systemd_services: "{{ openstack_hosts_systemd_services }}"
when:
- openstack_hosts_systemd_services
- name: Run the systemd mount role
include_role:
name: systemd_mount
vars:
systemd_mounts: "{{ openstack_hosts_systemd_mounts }}"
when:
- openstack_hosts_systemd_mounts