|
|
@ -80,7 +80,7 @@ options:
|
|
|
|
volumes:
|
|
|
|
volumes:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- List of volumes to mount within the container using docker CLI-style
|
|
|
|
- List of volumes to mount within the container using docker CLI-style
|
|
|
|
- 'syntax: C(/host:/container[:mode]) where "mode" may be "rw" or "ro".'
|
|
|
|
- 'syntax: C(/host:/container[:mode]) where "mode" may be "rw", "ro", "Z", "z".'
|
|
|
|
default: null
|
|
|
|
default: null
|
|
|
|
volumes_from:
|
|
|
|
volumes_from:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -626,14 +626,14 @@ class DockerManager(object):
|
|
|
|
# host mount (e.g. /mnt:/tmp, bind mounts host's /tmp to /mnt in the container)
|
|
|
|
# host mount (e.g. /mnt:/tmp, bind mounts host's /tmp to /mnt in the container)
|
|
|
|
elif 2 <= len(parts) <= 3:
|
|
|
|
elif 2 <= len(parts) <= 3:
|
|
|
|
# default to read-write
|
|
|
|
# default to read-write
|
|
|
|
ro = False
|
|
|
|
mode = 'rw'
|
|
|
|
# with supplied bind mode
|
|
|
|
# with supplied bind mode
|
|
|
|
if len(parts) == 3:
|
|
|
|
if len(parts) == 3:
|
|
|
|
if parts[2] not in ['ro', 'rw']:
|
|
|
|
if parts[2] not in ['ro', 'rw', 'z', 'Z']:
|
|
|
|
self.module.fail_json(msg='bind mode needs to either be "ro" or "rw"')
|
|
|
|
self.module.fail_json(msg='bind mode needs to be one of "ro", "rw", "z", or "Z"')
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
ro = parts[2] == 'ro'
|
|
|
|
mode = parts[2]
|
|
|
|
self.binds[parts[0]] = {'bind': parts[1], 'ro': ro }
|
|
|
|
self.binds[parts[0]] = {'bind': parts[1], 'mode': mode }
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.module.fail_json(msg='volumes support 1 to 3 arguments')
|
|
|
|
self.module.fail_json(msg='volumes support 1 to 3 arguments')
|
|
|
|
|
|
|
|
|
|
|
@ -1197,10 +1197,7 @@ class DockerManager(object):
|
|
|
|
for host_path, config in self.binds.iteritems():
|
|
|
|
for host_path, config in self.binds.iteritems():
|
|
|
|
if isinstance(config, dict):
|
|
|
|
if isinstance(config, dict):
|
|
|
|
container_path = config['bind']
|
|
|
|
container_path = config['bind']
|
|
|
|
if config['ro']:
|
|
|
|
mode = config['mode']
|
|
|
|
mode = 'ro'
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
mode = 'rw'
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
container_path = config
|
|
|
|
container_path = config
|
|
|
|
mode = 'rw'
|
|
|
|
mode = 'rw'
|
|
|
|