New option to trigger paunch configuration on only one container.
Adding the container_name option enables one to create playbook like this: - hosts: Compute gather_facts: true become: true tasks: - name: update one container paunch: config: "/var/lib/tripleo-config/container-startup-config/step_4" config_id: - 'tripleo_step4' container_name: ovn_controller action: apply container_cli: podman managed_by: tripleo-Compute config_overrides: image: undercloud-0.ctlplane.redhat.local:8787/openstack-ovn-controller:16.1_20201020.1_hotfix cleanup: True In this example we deliver an specific change to all Compute node without running the entire update process. This is only syntaxic sugar as running with: config: "/var/lib/tripleo-config/container-startup-config/step_4/hashed-ovn_controller.json" has the same effect. Note that config_overrides doesn't have the same semantic when we use the container_name option as we don't require the user to pass the full structure where it should be (still in the context of offering some more convenience to the user): { <container_name>: {<changed_key>: <change>, ...} } Here we prepend the container_name to the structure so that the user focus on the container parameter. This file has been deleted after ussuri so this patch starts at ussuri. Change-Id: I70ccfad3ea96dff44641bf70d459adb7cccb21d5
This commit is contained in:
parent
db6541dfb5
commit
21238eaf11
|
@ -106,6 +106,11 @@ options:
|
|||
- Whether or not we cleanup containers not in config. Useful only for apply action.
|
||||
type: bool
|
||||
default: True
|
||||
container_name:
|
||||
description:
|
||||
- If given just run paunch for the specified container.
|
||||
default: ""
|
||||
|
||||
"""
|
||||
|
||||
EXAMPLES = """
|
||||
|
@ -161,6 +166,14 @@ class PaunchManager:
|
|||
self.container_cli = self.module.params['container_cli']
|
||||
self.cleanup = self.module.params['cleanup']
|
||||
self.config_overrides = self.module.params['config_overrides']
|
||||
self.container_name = None
|
||||
if self.module.params['container_name']:
|
||||
self.container_name = self.module.params['container_name']
|
||||
# we simplify the user interface here, as if he/she wants
|
||||
# override and give a name then it must be for that container.
|
||||
self.config_overrides = {
|
||||
self.container_name: self.module.params['config_overrides']
|
||||
}
|
||||
self.container_log_stdout_path = \
|
||||
self.module.params['container_log_stdout_path']
|
||||
self.managed_by = self.module.params['managed_by']
|
||||
|
@ -184,8 +197,12 @@ class PaunchManager:
|
|||
if self.config.endswith('.json'):
|
||||
self.module.warn('Only one config was given, cleanup disabled')
|
||||
self.cleanup = False
|
||||
container_name = None
|
||||
if self.module.params['container_name']:
|
||||
container_name = self.module.params['container_name']
|
||||
self.config_yaml = putils_common.load_config(
|
||||
self.config,
|
||||
name=container_name,
|
||||
overrides=self.config_overrides)
|
||||
|
||||
if self.action == 'apply':
|
||||
|
|
Loading…
Reference in New Issue