paunch: allow to override any container config

This will enable an operator to override a paunch-managed container config.

Example given:

- name: Start containers for step 1
  paunch:
    config: /var/lib/tripleo-config/hashed-container-startup-config-step_1.json
    config_overrides:
      haproxy:
        image: docker.io/tripleomaster/centos-binary-haproxy:current-tripleo-hotfix
    config_id: tripleo_step1
    action: apply

Depends-On: I6639ab859b120aa9349dc72b0d6e7d575be20c7a
Change-Id: I48b1e749081e2f84cda3687f685f3c392817c89a
This commit is contained in:
Emilien Macchi 2020-01-08 22:39:15 -05:00
parent f8c53ca1d0
commit fac2c679d8
1 changed files with 12 additions and 1 deletions

View File

@ -66,6 +66,11 @@ options:
choices:
- apply
- cleanup
config_overrides:
description:
- Dictionary to override containers configs
default: {}
type: dict
container_cli:
description:
- The container CLI.
@ -103,6 +108,9 @@ EXAMPLES = """
- name: Start containers for step 1
paunch:
config: /var/lib/tripleo-config/hashed-container-startup-config-step_1.json
config_overrides:
haproxy:
image: docker.io/tripleomaster/centos-binary-haproxy:current-tripleo-hotfix
config_id: tripleo_step1
action: apply
# Paunch cleanup example
@ -133,6 +141,7 @@ class PaunchManager:
self.healthcheck_disabled = \
self.module.params['healthcheck_disabled']
self.container_cli = self.module.params['container_cli']
self.config_overrides = 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']
@ -150,7 +159,9 @@ class PaunchManager:
log_file=self.log_file)
if self.config:
self.config_yaml = putils_common.load_config(self.config)
self.config_yaml = putils_common.load_config(
self.config,
overrides=self.config_overrides)
if self.action == 'apply':
self.paunch_apply()