Merge pull request #1102 from heiparta/extra_hosts
Add support for extra_hosts to docker module
This commit is contained in:
commit
09aa79c58f
1 changed files with 10 additions and 1 deletions
|
@ -246,6 +246,9 @@ options:
|
|||
retries.
|
||||
default: 0
|
||||
version_added: "1.9"
|
||||
extra_hosts:
|
||||
description:
|
||||
- Dict of custom host-to-IP mappings to be defined in the container
|
||||
insecure_registry:
|
||||
description:
|
||||
- Use insecure private registry by HTTP instead of HTTPS. Needed for
|
||||
|
@ -492,6 +495,7 @@ class DockerManager(object):
|
|||
'dns': ((0, 3, 0), '1.10'),
|
||||
'volumes_from': ((0, 3, 0), '1.10'),
|
||||
'restart_policy': ((0, 5, 0), '1.14'),
|
||||
'extra_hosts': ((0, 7, 0), '1.3.1'),
|
||||
'pid': ((1, 0, 0), '1.17'),
|
||||
# Clientside only
|
||||
'insecure_registry': ((0, 5, 0), '0.0')
|
||||
|
@ -1233,7 +1237,7 @@ class DockerManager(object):
|
|||
|
||||
optionals = {}
|
||||
for optional_param in ('dns', 'volumes_from', 'restart_policy',
|
||||
'restart_policy_retry', 'pid'):
|
||||
'restart_policy_retry', 'pid', 'extra_hosts'):
|
||||
optionals[optional_param] = self.module.params.get(optional_param)
|
||||
|
||||
if optionals['dns'] is not None:
|
||||
|
@ -1254,6 +1258,10 @@ class DockerManager(object):
|
|||
self.ensure_capability('pid')
|
||||
params['pid_mode'] = optionals['pid']
|
||||
|
||||
if optionals['extra_hosts'] is not None:
|
||||
self.ensure_capability('extra_hosts')
|
||||
params['extra_hosts'] = optionals['extra_hosts']
|
||||
|
||||
for i in containers:
|
||||
self.client.start(i['Id'], **params)
|
||||
self.increment_counter('started')
|
||||
|
@ -1438,6 +1446,7 @@ def main():
|
|||
state = dict(default='started', choices=['present', 'started', 'reloaded', 'restarted', 'stopped', 'killed', 'absent', 'running']),
|
||||
restart_policy = dict(default=None, choices=['always', 'on-failure', 'no']),
|
||||
restart_policy_retry = dict(default=0, type='int'),
|
||||
extra_hosts = dict(type='dict'),
|
||||
debug = dict(default=False, type='bool'),
|
||||
privileged = dict(default=False, type='bool'),
|
||||
stdin_open = dict(default=False, type='bool'),
|
||||
|
|
Loading…
Reference in a new issue