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')