From 857e63f2ebac9973f21da8e839c2c78c53be2c90 Mon Sep 17 00:00:00 2001 From: Fran Jurinec Date: Tue, 2 Jul 2024 13:28:48 +0200 Subject: [PATCH] Add support from device_cgroup_rules parameter --- plugins/module_utils/module_container/base.py | 6 ++++++ plugins/module_utils/module_container/docker_api.py | 3 +++ plugins/modules/docker_container.py | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/plugins/module_utils/module_container/base.py b/plugins/module_utils/module_container/base.py index 410ffb153..e10acea84 100644 --- a/plugins/module_utils/module_container/base.py +++ b/plugins/module_utils/module_container/base.py @@ -895,6 +895,11 @@ def _compare_platform(option, param_value, container_value): )) ) +OPTION_DEVICE_CGROUP_RULES = ( + OptionGroup() + .add_option('device_cgroup_rules', type='list', elements='str') +) + OPTION_DNS_SERVERS = ( OptionGroup() .add_option('dns_servers', type='list', elements='str') @@ -1194,6 +1199,7 @@ def _compare_platform(option, param_value, container_value): OPTION_DEVICE_READ_IOPS, OPTION_DEVICE_WRITE_IOPS, OPTION_DEVICE_REQUESTS, + OPTION_DEVICE_CGROUP_RULES, OPTION_DNS_SERVERS, OPTION_DNS_OPTS, OPTION_DNS_SEARCH_DOMAINS, diff --git a/plugins/module_utils/module_container/docker_api.py b/plugins/module_utils/module_container/docker_api.py index d3da84fe5..73ce6738f 100644 --- a/plugins/module_utils/module_container/docker_api.py +++ b/plugins/module_utils/module_container/docker_api.py @@ -44,6 +44,7 @@ OPTION_DEVICE_READ_IOPS, OPTION_DEVICE_WRITE_IOPS, OPTION_DEVICE_REQUESTS, + OPTION_DEVICE_CGROUP_RULES, OPTION_DNS_SERVERS, OPTION_DNS_OPTS, OPTION_DNS_SEARCH_DOMAINS, @@ -1290,6 +1291,8 @@ def _preprocess_container_names(module, client, api_version, value): OPTION_DEVICE_REQUESTS.add_engine('docker_api', DockerAPIEngine.host_config_value( 'DeviceRequests', min_api_version='1.40', preprocess_value=_preprocess_device_requests)) +OPTION_DEVICE_CGROUP_RULES.add_engine('docker_api', DockerAPIEngine.host_config_value('DeviceCgroupsRules')) + OPTION_DNS_SERVERS.add_engine('docker_api', DockerAPIEngine.host_config_value('Dns')) OPTION_DNS_OPTS.add_engine('docker_api', DockerAPIEngine.host_config_value('DnsOptions')) diff --git a/plugins/modules/docker_container.py b/plugins/modules/docker_container.py index 20cc88d93..e754568f2 100644 --- a/plugins/modules/docker_container.py +++ b/plugins/modules/docker_container.py @@ -299,6 +299,11 @@ - Driver-specific options. type: dict version_added: 0.1.0 + device_cgroup_rules: + description: + - List of cgroup rules to apply to the container. + type: list + elements: str dns_opts: description: - List of DNS options.