From 2e661d170043b1a70fa977f5242cf390cddfbd8a Mon Sep 17 00:00:00 2001 From: ant-bl <47523786+ant-bl@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:04:40 +0100 Subject: [PATCH] Update env_file to accept a list of files instead of a single file (#702) * Update env_file to accept a list of files instead of a single file Signed-off-by: antoine * Update doc: add alias env_files Signed-off-by: antoine * Update plugins/module_utils/podman/podman_container_lib.py Use real arg name and not alias Co-authored-by: Sergey <6213510+sshnaidm@users.noreply.github.com> --------- Signed-off-by: antoine Co-authored-by: Sergey <6213510+sshnaidm@users.noreply.github.com> --- plugins/module_utils/podman/podman_container_lib.py | 6 ++++-- plugins/modules/podman_container.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/module_utils/podman/podman_container_lib.py b/plugins/module_utils/podman/podman_container_lib.py index e35649ca..ff4c1862 100644 --- a/plugins/module_utils/podman/podman_container_lib.py +++ b/plugins/module_utils/podman/podman_container_lib.py @@ -57,7 +57,7 @@ dns_search=dict(type='str', aliases=['dns_search_domains']), entrypoint=dict(type='str'), env=dict(type='dict'), - env_file=dict(type='path'), + env_file=dict(type='list', elements='path', aliases=['env_files']), env_host=dict(type='bool'), etc_hosts=dict(type='dict', aliases=['add_hosts']), expose=dict(type='list', elements='str', aliases=[ @@ -407,7 +407,9 @@ def addparam_env(self, c): return c def addparam_env_file(self, c): - return c + ['--env-file', self.params['env_file']] + for env_file in self.params['env_file']: + c += ['--env-file', env_file] + return c def addparam_env_host(self, c): self.check_version('--env-host', minv='1.5.0') diff --git a/plugins/modules/podman_container.py b/plugins/modules/podman_container.py index 4d23fe35..51cb57a5 100644 --- a/plugins/modules/podman_container.py +++ b/plugins/modules/podman_container.py @@ -295,7 +295,10 @@ running, not on the controller machine where Ansible is executing. If you need to copy the file from controller to remote machine, use the copy or slurp module. - type: path + type: list + elements: path + aliases: + - env_files env_host: description: - Use all current host environment variables in container.