mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add support for tmpfs to docker_container. (#25747)
This commit is contained in:
parent
f6e4019804
commit
42b608db0c
1 changed files with 28 additions and 1 deletions
|
@ -426,6 +426,12 @@ options:
|
||||||
- If true, skip image verification.
|
- If true, skip image verification.
|
||||||
default: false
|
default: false
|
||||||
required: false
|
required: false
|
||||||
|
tmpfs:
|
||||||
|
description:
|
||||||
|
- Mount a tmpfs directory
|
||||||
|
default: null
|
||||||
|
required: false
|
||||||
|
version_added: 2.4
|
||||||
tty:
|
tty:
|
||||||
description:
|
description:
|
||||||
- Allocate a pseudo-TTY.
|
- Allocate a pseudo-TTY.
|
||||||
|
@ -768,6 +774,7 @@ class TaskParameters(DockerBaseClass):
|
||||||
self.state = None
|
self.state = None
|
||||||
self.stop_signal = None
|
self.stop_signal = None
|
||||||
self.stop_timeout = None
|
self.stop_timeout = None
|
||||||
|
self.tmpfs = None
|
||||||
self.trust_image_content = None
|
self.trust_image_content = None
|
||||||
self.tty = None
|
self.tty = None
|
||||||
self.user = None
|
self.user = None
|
||||||
|
@ -803,6 +810,7 @@ class TaskParameters(DockerBaseClass):
|
||||||
if self.volumes:
|
if self.volumes:
|
||||||
self.volumes = self._expand_host_paths()
|
self.volumes = self._expand_host_paths()
|
||||||
|
|
||||||
|
self.tmpfs = self._parse_tmpfs()
|
||||||
self.env = self._get_environment()
|
self.env = self._get_environment()
|
||||||
self.ulimits = self._parse_ulimits()
|
self.ulimits = self._parse_ulimits()
|
||||||
self.sysctls = self._parse_sysctls()
|
self.sysctls = self._parse_sysctls()
|
||||||
|
@ -966,7 +974,8 @@ class TaskParameters(DockerBaseClass):
|
||||||
shm_size='shm_size',
|
shm_size='shm_size',
|
||||||
group_add='groups',
|
group_add='groups',
|
||||||
devices='devices',
|
devices='devices',
|
||||||
pid_mode='pid_mode'
|
pid_mode='pid_mode',
|
||||||
|
tmpfs='tmpfs'
|
||||||
)
|
)
|
||||||
|
|
||||||
if HAS_DOCKER_PY_2:
|
if HAS_DOCKER_PY_2:
|
||||||
|
@ -1161,6 +1170,22 @@ class TaskParameters(DockerBaseClass):
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
self.fail('Error parsing logging options - %s' % (exc))
|
self.fail('Error parsing logging options - %s' % (exc))
|
||||||
|
|
||||||
|
def _parse_tmpfs(self):
|
||||||
|
'''
|
||||||
|
Turn tmpfs into a hash of Tmpfs objects
|
||||||
|
'''
|
||||||
|
result = dict()
|
||||||
|
if self.tmpfs is None:
|
||||||
|
return result
|
||||||
|
|
||||||
|
for tmpfs_spec in self.tmpfs:
|
||||||
|
split_spec = tmpfs_spec.split(":", 1)
|
||||||
|
if len(split_spec) > 1:
|
||||||
|
result[split_spec[0]] = split_spec[1]
|
||||||
|
else:
|
||||||
|
result[split_spec[0]] = ""
|
||||||
|
return result
|
||||||
|
|
||||||
def _get_environment(self):
|
def _get_environment(self):
|
||||||
"""
|
"""
|
||||||
If environment file is combined with explicit environment variables, the explicit environment variables
|
If environment file is combined with explicit environment variables, the explicit environment variables
|
||||||
|
@ -1304,6 +1329,7 @@ class Container(DockerBaseClass):
|
||||||
# shm_size=host_config.get('ShmSize'),
|
# shm_size=host_config.get('ShmSize'),
|
||||||
security_opts=host_config.get("SecurityOpt"),
|
security_opts=host_config.get("SecurityOpt"),
|
||||||
stop_signal=config.get("StopSignal"),
|
stop_signal=config.get("StopSignal"),
|
||||||
|
tmpfs=host_config.get('Tmpfs'),
|
||||||
tty=config.get('Tty'),
|
tty=config.get('Tty'),
|
||||||
expected_ulimits=host_config.get('Ulimits'),
|
expected_ulimits=host_config.get('Ulimits'),
|
||||||
expected_sysctls=host_config.get('Sysctls'),
|
expected_sysctls=host_config.get('Sysctls'),
|
||||||
|
@ -2070,6 +2096,7 @@ def main():
|
||||||
state=dict(type='str', choices=['absent', 'present', 'started', 'stopped'], default='started'),
|
state=dict(type='str', choices=['absent', 'present', 'started', 'stopped'], default='started'),
|
||||||
stop_signal=dict(type='str'),
|
stop_signal=dict(type='str'),
|
||||||
stop_timeout=dict(type='int'),
|
stop_timeout=dict(type='int'),
|
||||||
|
tmpfs=dict(type='list'),
|
||||||
trust_image_content=dict(type='bool', default=False),
|
trust_image_content=dict(type='bool', default=False),
|
||||||
tty=dict(type='bool', default=False),
|
tty=dict(type='bool', default=False),
|
||||||
ulimits=dict(type='list'),
|
ulimits=dict(type='list'),
|
||||||
|
|
Loading…
Reference in a new issue