From 807d964a4863241da758eb29d8e2b3463aa2f643 Mon Sep 17 00:00:00 2001 From: Maksim Losev Date: Sun, 14 Dec 2014 06:56:30 +0300 Subject: [PATCH] Add insecure_registry to docker-py pull method Starting from docker-py>=0.5.0 it is impossible to work with private registries based on HTTP. So we need additional parameter to allow pull from insecure registry Related to ansible/ansible#9111 --- lib/ansible/modules/cloud/docker/docker.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/docker/docker.py b/lib/ansible/modules/cloud/docker/docker.py index fb24bb0fe08..d796c17407d 100644 --- a/lib/ansible/modules/cloud/docker/docker.py +++ b/lib/ansible/modules/cloud/docker/docker.py @@ -224,6 +224,13 @@ options: default: false aliases: [] version_added: "1.9" + insecure_registry: + description: + - Use insecure private registry by HTTP instead of HTTPS (needed for docker-py >= 0.5.0). + required: false + default: false + aliases: [] + version_added: "1.9" author: Cove Schneider, Joshua Conner, Pavel Antonov requirements: [ "docker-py >= 0.3.0", "docker >= 0.10.0" ] @@ -743,7 +750,7 @@ class DockerManager: except: self.module.fail_json(msg="failed to login to the remote registry, check your username/password.") try: - self.client.pull(image, tag=tag) + self.client.pull(image, tag=tag, insecure_registry=self.module.params.get('insecure_registry')) except: self.module.fail_json(msg="failed to pull the specified image: %s" % resource) self.increment_counter('pull') @@ -840,7 +847,8 @@ def main(): tty = dict(default=False, type='bool'), lxc_conf = dict(default=None, type='list'), name = dict(default=None), - net = dict(default=None) + net = dict(default=None), + insecure_registry = dict(default=False, type='bool'), ) )