Last active
August 29, 2015 14:03
-
-
Save pixie79/94dbf8458fa86dc34936 to your computer and use it in GitHub Desktop.
Ansible Docker patch to allow for authenticated pull
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/library/cloud/docker b/library/cloud/docker | |
index 79c6145..c77bb46 100644 | |
--- a/library/cloud/docker | |
+++ b/library/cloud/docker | |
@@ -557,7 +557,7 @@ class DockerManager: | |
'detach': self.module.params.get('detach'), | |
'name': self.module.params.get('name'), | |
'stdin_open': self.module.params.get('stdin_open'), | |
- 'tty': self.module.params.get('tty'), | |
+ 'tty': self.module.params.get('tty') | |
} | |
if docker.utils.compare_version('1.10', self.client.version()['ApiVersion']) < 0: | |
@@ -576,6 +576,11 @@ class DockerManager: | |
try: | |
containers = do_create(count, params) | |
except: | |
+ if self.module.params.get('user'): | |
+ self.client.login(self.module.params.get('user'), | |
+ password=self.module.params.get('password'), | |
+ email=self.module.params.get('email'), | |
+ registry="https://" + self.module.params.get('registry') + "/v1/") | |
self.client.pull(params['image']) | |
self.increment_counter('pull') | |
containers = do_create(count, params) | |
@@ -665,6 +670,7 @@ def main(): | |
user = dict(default=None), | |
password = dict(), | |
email = dict(), | |
+ registry = dict(), | |
hostname = dict(default=None), | |
env = dict(type='list'), | |
dns = dict(), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment