diff --git a/docs/podman_container_module.html b/docs/podman_container_module.html index e4476225..d93d1802 100644 --- a/docs/podman_container_module.html +++ b/docs/podman_container_module.html @@ -771,6 +771,14 @@

Parameters

Specify a max size of the log file (e.g 10mb).

+
+
+

max_file

+

string

+
+

Specify a max number of the log files (e.g 10).

+
+

path

diff --git a/plugins/module_utils/podman/podman_container_lib.py b/plugins/module_utils/podman/podman_container_lib.py index 33530fd3..c7df9cc9 100644 --- a/plugins/module_utils/podman/podman_container_lib.py +++ b/plugins/module_utils/podman/podman_container_lib.py @@ -90,6 +90,7 @@ log_opt=dict(type='dict', aliases=['log_options'], options=dict( max_size=dict(type='str'), + max_file=dict(type='str'), path=dict(type='str'), tag=dict(type='str'))), mac_address=dict(type='str'), @@ -473,6 +474,16 @@ def addparam_log_opt(self, c): errors='surrogate_or_strict')])] return c + def addparam_log_opt_file_size(self, c): + for k, v in self.params['log_opt'].items(): + if v is not None: + c += ['--log-opt', + b"=".join([to_bytes(k.replace('max_file', 'max-file'), + errors='surrogate_or_strict'), + to_bytes(v, + errors='surrogate_or_strict')])] + return c + def addparam_log_level(self, c): return c + ['--log-level', self.params['log_level']] diff --git a/tests/integration/targets/podman_container_idempotency/tasks/idem_all.yml b/tests/integration/targets/podman_container_idempotency/tasks/idem_all.yml index 02387834..045220d8 100644 --- a/tests/integration/targets/podman_container_idempotency/tasks/idem_all.yml +++ b/tests/integration/targets/podman_container_idempotency/tasks/idem_all.yml @@ -177,6 +177,7 @@ log_opt: path: /tmp/container3.log max_size: 100mb + max_file: '10' tag: sometag command: 1h diff --git a/tests/integration/targets/podman_play/tasks/play-with-options.yml b/tests/integration/targets/podman_play/tasks/play-with-options.yml index aeb79a5b..45c6b0c7 100644 --- a/tests/integration/targets/podman_play/tasks/play-with-options.yml +++ b/tests/integration/targets/podman_play/tasks/play-with-options.yml @@ -19,6 +19,7 @@ log_opt: path: "{{ log_opt.path }}" max_size: "{{ log_opt.size }}" + max_file: "{{ log_opt.file }}" register: play_pod - name: Get pod info