Skip to content

Commit c772e97

Browse files
committed
Make config directories consistent across services
Some services used edpm_container_standalone and some services directly use edpm_container_manage and the way we generate the config files and use them is spread across multiple locations which is confusing and difficult to troubleshoot. This sanitizes the locations. Signed-off-by: rabi <[email protected]>
1 parent 54f5629 commit c772e97

File tree

41 files changed

+96
-94
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+96
-94
lines changed

docs/source/roles/role-edpm_container_manage.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ This Ansible role allows to do the following tasks:
6363

6464
.. code-block:: YAML
6565
66-
- name: Manage step_1 containers using edpm-ansible
66+
- name: Manage containers using edpm-ansible
6767
block:
68-
- name: "Manage containers for step 1 with edpm-ansible"
68+
- name: "Manage containers with edpm-ansible"
6969
include_role:
7070
name: edpm_container_manage
7171
vars:
72-
edpm_container_manage_config: "/var/lib/edpm-config/container-startup-config/step_1"
73-
edpm_container_manage_config_id: "edpm_step1"
72+
edpm_container_manage_config: "/var/lib/openstack/config/containers"
73+
edpm_container_manage_config_id: "nova"
7474
7575
7676
Healthchecks
@@ -120,29 +120,27 @@ This can be used to:
120120
* Output the container commands that are run to to manage containers lifecycle.
121121
* Output the changes that would have been made on containers by Ansible.
122122

123-
.. note:: To manage a single container, you need to know 2 things:
124-
125-
* At which step the container is deployed.
123+
.. note:: To manage a single container, you need to know:
126124

127125
* The name of the generated JSON file for container config.
128126

129-
Here is an example of a playbook to manage HAproxy container at step 1 which
127+
Here is an example of a playbook to manage HAproxy container which
130128
overrides the image setting in one-off.
131129

132130
.. code-block:: YAML
133131
134132
- hosts: localhost
135133
become: true
136134
tasks:
137-
- name: Manage step_1 containers using edpm-ansible
135+
- name: Manage containers using edpm-ansible
138136
block:
139-
- name: "Manage HAproxy container at step 1 with edpm-ansible"
137+
- name: "Manage HAproxy container with edpm-ansible"
140138
include_role:
141139
name: edpm_container_manage
142140
vars:
143141
edpm_container_manage_config_patterns: 'haproxy.json'
144-
edpm_container_manage_config: "/var/lib/edpm-config/container-startup-config/step_1"
145-
edpm_container_manage_config_id: "edpm_step1"
142+
edpm_container_manage_config: "/var/lib/openstack/config/containers"
143+
edpm_container_manage_config_id: "haproxy"
146144
edpm_container_manage_clean_orphans: false
147145
edpm_container_manage_config_overrides:
148146
haproxy:

plugins/filter/helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import ast
1818
import binascii
1919
import json
20+
import os
2021
import re
2122

2223

plugins/modules/container_config_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@
7272
EXAMPLES = """
7373
- name: Generate containers configs data
7474
container_config_data:
75-
config_path: /var/lib/edpm-config/container-startup-config/step_1
75+
config_path: /var/lib/openstack/config/containers/nova
7676
- name: Generate containers configs data for HAproxy and override image
7777
container_config_data:
78-
config_path: /var/lib/edpm-config/container-startup-config/step_1
78+
config_path: /var/lib/openstack/config/containers/haproxy
7979
config_pattern: 'haproxy.json'
8080
config_overrides:
8181
haproxy:

plugins/modules/container_config_hash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
container_config_hash:
6464
"""
6565

66-
CONTAINER_STARTUP_CONFIG = '/var/lib/edpm-config/container-startup-config'
66+
CONTAINER_STARTUP_CONFIG = '/var/lib/openstack/config/containers'
6767
BUF_SIZE = 65536
6868

6969

@@ -86,7 +86,7 @@ def __init__(self, module, results):
8686
# Set parameters
8787
self.config_vol_prefix = args['config_vol_prefix']
8888

89-
# Update container-startup-config with new config hashes
89+
# Update containers config with new config hashes
9090
self._update_hashes()
9191

9292
self.module.exit_json(**self.results)

plugins/modules/edpm_container_manage.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
options:
5151
config_id:
5252
description:
53-
- Config id for the label
53+
- Service name for container labeling and isolation
5454
type: str
5555
required: True
5656
config_dir:
@@ -91,8 +91,8 @@
9191
EXAMPLES = """
9292
- name: Run containers
9393
edpm_container_manage:
94-
config_id: edpm_step1
95-
config_dir: /var/lib/edpm-config/container-startup-config/step_1
94+
config_id: nova
95+
config_dir: /var/lib/openstack/config/containers
9696
"""
9797

9898

@@ -124,7 +124,9 @@ def __init__(self, module, results):
124124
# Set parameters
125125
self.concurrency = args.get('concurrency', 4)
126126
self.config_id = args.get('config_id')
127-
self.config_dir = args.get('config_dir')
127+
base_config_dir = args.get('config_dir')
128+
# Create service-specific subdirectory based on config_id
129+
self.config_dir = os.path.join(base_config_dir, self.config_id)
128130
self.config_patterns = args.get('config_patterns')
129131
self.config_overrides = args['config_overrides']
130132
self.log_base_path = args.get('log_base_path')

roles/edpm_container_manage/defaults/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ edpm_container_manage_clean_orphans: true
2323
edpm_container_manage_update_config_hash: true
2424
edpm_container_manage_cli: podman
2525
edpm_container_manage_concurrency: 1
26-
edpm_container_manage_config: "/var/lib/edpm-config/"
27-
edpm_container_manage_config_id: edpm
26+
edpm_container_manage_config: "/var/lib/openstack/config/containers"
27+
edpm_container_manage_config_id: nova
2828
edpm_container_manage_config_overrides: {}
2929
edpm_container_manage_config_patterns: '*.json'
3030
edpm_container_manage_healthcheck_disabled: false

roles/edpm_container_manage/meta/argument_specs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ argument_specs:
2121
default: 1
2222
edpm_container_manage_config:
2323
type: str
24-
default: "/var/lib/edpm-config/"
24+
default: "/var/lib/openstack/config/containers"
2525
edpm_container_manage_config_id:
2626
type: str
27-
default: edpm
27+
default: nova
2828
edpm_container_manage_config_overrides:
2929
type: dict
3030
default: {}

roles/edpm_container_standalone/defaults/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
edpm_container_standalone_service: ""
2424
# Directory for kolla config files
2525
edpm_container_standalone_kolla_config_dir: /var/lib/kolla/config_files
26-
# Directory for container startup configs
27-
edpm_container_standalone_container_startup_config_dir: /var/lib/edpm-config/container-startup-config
26+
# Directory for container startup configs (service-specific subdirectory will be created)
27+
edpm_container_standalone_container_startup_config_dir: /var/lib/openstack/config/containers
2828
# Hash with keys of container name and value of YAML kolla config file.
2929
edpm_container_standalone_kolla_config_files: {}
3030
# Hash with keys of container name and value of YAML container definition
@@ -64,4 +64,4 @@ edpm_container_standalone_volumes: "{{
6464
}}"
6565

6666
edpm_deploy_identifier: ''
67-
edpm_iscsid_config_volume: /var/lib/config-data/ansible-generated/iscsid
67+
edpm_iscsid_config_volume: /var/lib/config-data/iscsid

roles/edpm_container_standalone/meta/argument_specs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ argument_specs:
2121
description: Parsed container definitions.
2222
type: dict
2323
edpm_container_standalone_container_startup_config_dir:
24-
default: /var/lib/edpm-config/container-startup-config
25-
description: Path to configuration directory.
24+
default: /var/lib/openstack/config/containers
25+
description: Base path to configuration directory. Service-specific subdirectory will be created.
2626
type: path
2727
edpm_container_standalone_internal_tls_volumes:
2828
default:
@@ -64,6 +64,6 @@ argument_specs:
6464
description: Path to TLS certificate.
6565
type: path
6666
edpm_iscsid_config_volume:
67-
default: /var/lib/config-data/ansible-generated/iscsid
67+
default: /var/lib/config-data/iscsid
6868
description: Path to iscsid config directory.
6969
type: path

roles/edpm_container_standalone/tasks/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@
3333
mode: "0600"
3434
loop: "{{ edpm_container_standalone_kolla_config_files | dict2items }}"
3535

36-
- name: "Create config file {{ edpm_container_standalone_container_startup_config_dir + '/' + edpm_container_standalone_service }}"
36+
- name: "Ensure container config directory exists: {{ edpm_container_standalone_container_startup_config_dir }}/{{ edpm_container_standalone_service }}"
3737
become: true
3838
ansible.builtin.file:
3939
path: "{{ edpm_container_standalone_container_startup_config_dir }}/{{ edpm_container_standalone_service }}"
4040
state: directory
4141
mode: "0755"
42+
setype: "container_file_t"
4243

4344
- name: "Render container definitions: [{{ edpm_container_standalone_service }} ]"
4445
become: true
@@ -55,6 +56,6 @@
5556
ansible.builtin.include_role:
5657
name: edpm_container_manage
5758
vars:
58-
edpm_container_manage_config: "{{ edpm_container_standalone_container_startup_config_dir }}/{{ edpm_container_standalone_service }}"
59+
edpm_container_manage_config: "{{ edpm_container_standalone_container_startup_config_dir }}"
5960
edpm_container_manage_config_patterns: "*.json"
6061
edpm_container_manage_config_id: "{{ edpm_container_standalone_service }}"

0 commit comments

Comments
 (0)