Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/source/roles/role-edpm_container_manage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ overrides the image setting in one-off.
edpm_container_manage_config_patterns: 'haproxy.json'
edpm_container_manage_config: "/var/lib/edpm-config/container-startup-config/step_1"
edpm_container_manage_config_id: "edpm_step1"
edpm_container_manage_clean_orphans: false
edpm_container_manage_config_overrides:
haproxy:
image: quay.io/edpmmastercentos9/centos-binary-haproxy:hotfix
Expand All @@ -164,10 +163,11 @@ containers by Ansible.

$ ansible-playbook haproxy.yaml --check --diff

The ``edpm_container_manage_clean_orphans`` parameter is optional
and can be set to `false` to not clean orphaned containers for a
config_id. It can be used to manage a single container without
impacting other running containers with same config_id.
.. warning::

The ``edpm_container_manage_clean_orphans`` parameter is **deprecated** and will be removed in a future release.
While it still functions, users should migrate to using ``edpm_cleanup_orphaned_containers`` in the
``edpm_container_standalone`` role instead, which provides better state-file aware orphan cleanup.

The ``edpm_container_manage_config_overrides`` parameter is optional
and can be used to override a specific container attribute like the image
Expand Down
41 changes: 41 additions & 0 deletions playbooks/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# Copyright 2025 Red Hat, Inc.
# All Rights Reserved.
#
# 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: Cleanup EDPM Services
hosts: "{{ edpm_override_hosts | default('all', true) }}"
strategy: linear
gather_facts: "{{ gather_facts | default(false) }}"
any_errors_fatal: "{{ edpm_any_errors_fatal | default(true) }}"
max_fail_percentage: "{{ edpm_max_fail_percentage | default(0) }}"
environment: "{{ edpm_playbook_environment | default({}) }}"
tasks:
- name: Display cleanup information
ansible.builtin.debug:
msg:
- "=========================================="
- "Services to keep (from edpm_service_types):"
- "{{ edpm_service_types | default([]) | join(', ') }}"
- "=========================================="
- "This will clean up all services NOT in edpm_service_types:"
- " - Stop and disable systemd services"
- " - Remove containers"
- " - Remove configuration directories"
- " - Update state file"
- "=========================================="

- name: Cleanup services
ansible.builtin.include_role:
name: osp.edpm.edpm_cleanup
3 changes: 3 additions & 0 deletions playbooks/nova.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

- name: Deploy EDPM Nova storage infrastructure
ansible.builtin.import_playbook: nova_storage.yml
vars:
edpm_service_name: nova

- name: Deploy EDPM Nova
hosts: "{{ edpm_override_hosts | default('all', true) }}"
strategy: linear
Expand Down
2 changes: 1 addition & 1 deletion plugins/filter/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def needs_delete(self, container_infos, config, config_id,
:param container_infos: list
:param config: dict
:param config_id: string
:param clean_orphans: bool
:param clean_orphans: bool (DEPRECATED - use edpm_cleanup_orphaned_containers instead)
:param check_config: bool to whether or not check if config changed
:returns: list
"""
Expand Down
19 changes: 0 additions & 19 deletions plugins/filter/needs_delete.yml

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/modules/container_config_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
description:
- Config volume prefix
type: str
default: '/var/lib/config-data'
default: '/var/lib/openstack'
"""

EXAMPLES = """
Expand Down
13 changes: 13 additions & 0 deletions plugins/modules/edpm_container_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@
- Number of podman actions to run at the same time
type: int
default: 1
containers:
description:
- List of specific container names to manage
- If empty, all containers matching the pattern will be managed
type: list
elements: str
default: []
debug:
description:
- Enable debug
Expand Down Expand Up @@ -127,6 +134,7 @@ def __init__(self, module, results):
self.config_dir = args.get('config_dir')
self.config_patterns = args.get('config_patterns')
self.config_overrides = args['config_overrides']
self.containers = args.get('containers', [])
self.log_base_path = args.get('log_base_path')
self.debug = args.get('debug')

Expand Down Expand Up @@ -155,6 +163,11 @@ def _get_configs(self):
self.config_patterns))
for match in matches:
name = os.path.splitext(os.path.basename(match))[0]
# Skip if specific containers list provided and this isn't in it
if self.containers and name not in self.containers:
if self.debug:
self.module.debug(f'Skipping {name} - not in containers list')
continue
with open(match, 'r') as data:
config = json.loads(data.read())
if self.debug:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/edpm_nftables_from_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- name: Get nftables rules
register: edpm_nftables_rules
edpm_nftables_from_files:
src: /var/lib/edpm-config/firewall
src: /var/lib/openstack/firewall
"""

RETURN = """
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/edpm_nftables_snippet.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
EXAMPLES = """
- name: Inject snippet for CI
edpm_nftables_snippet:
dest: /var/lib/edpm-config/firewall/ci-rules.yaml
dest: /var/lib/openstack/firewall/ci-rules.yaml
content: |
- rule_name: 010 Allow SSH from everywhere
rule:
Expand Down
Loading