From d5c5cb5a17b317fc24d1714a38edd4cbb7c16720 Mon Sep 17 00:00:00 2001 From: Patrick Easters Date: Wed, 15 Jan 2020 12:47:12 -0500 Subject: [PATCH] podman_image: Use provided credentials when pulling image (#66372) * Use credentials when pulling from a remote registry --- changelogs/fragments/66372-podman-image-pull-credentials.yml | 2 ++ lib/ansible/modules/cloud/podman/podman_image.py | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 changelogs/fragments/66372-podman-image-pull-credentials.yml diff --git a/changelogs/fragments/66372-podman-image-pull-credentials.yml b/changelogs/fragments/66372-podman-image-pull-credentials.yml new file mode 100644 index 00000000000..c3b3378dae2 --- /dev/null +++ b/changelogs/fragments/66372-podman-image-pull-credentials.yml @@ -0,0 +1,2 @@ +bugfixes: + - podman_image - honor username and password options when pulling image from a remote registry \ No newline at end of file diff --git a/lib/ansible/modules/cloud/podman/podman_image.py b/lib/ansible/modules/cloud/podman/podman_image.py index 7efd4b67c14..48f4c3b7d51 100644 --- a/lib/ansible/modules/cloud/podman/podman_image.py +++ b/lib/ansible/modules/cloud/podman/podman_image.py @@ -489,6 +489,10 @@ class PodmanImageManager(object): if self.auth_file: args.extend(['--authfile', self.auth_file]) + if self.username and self.password: + cred_string = '{user}:{password}'.format(user=self.username, password=self.password) + args.extend(['--creds', cred_string]) + if self.validate_certs: args.append('--tls-verify')