containers.podman.podman_login 模块 – 使用 podman 登录容器注册表
注意
此模块是 containers.podman 集合 (版本 1.16.2) 的一部分。
如果您正在使用 ansible
包,您可能已经安装了这个集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install containers.podman
。您需要更多要求才能使用此模块,请参阅要求以了解详细信息。
要在 Playbook 中使用它,请指定:containers.podman.podman_login
。
概要
使用 podman login 命令登录到容器注册表服务器。如果未指定注册表,将使用 `registries.conf` 中 `[registries.search]` 下的第一个注册表。用户可以通过设置 `authfile` 标志来覆盖身份验证文件的路径。使用的默认路径是 `${XDG_RUNTIME_DIR}/containers/auth.json`。
要求
在执行此模块的主机上需要以下要求。
主机上安装了 Podman
参数
参数 |
注释 |
---|---|
身份验证文件的路径。默认为``${XDG_RUNTIME_DIR}/containers/auth.json``。您还可以通过设置 ``REGISTRY_AUTH_FILE`` 环境变量来覆盖身份验证文件的默认路径。``export REGISTRY_AUTH_FILE=path`` |
|
使用路径 (*.crt, *.cert, *.key) 中的证书连接到注册表。默认证书目录为 /etc/containers/certs.d。 |
|
如果 默认值: |
|
注册表服务器的密码。 |
|
注册表服务器。如果未指定注册表,将使用 `registries.conf` 中 `[registries.search]` 下的第一个注册表。 |
|
要用于目标注册表身份验证的现有 |
|
在联系注册表时需要 HTTPS 并验证证书。如果明确设置为 true,则将使用 TLS 验证。如果设置为 false,则将不使用 TLS 验证。如果未指定,将使用 TLS 验证,除非目标注册表在 registries.conf 中被列为不安全注册表。 选项
|
|
注册表服务器的用户名。 |
示例
- name: Login to default registry and create ${XDG_RUNTIME_DIR}/containers/auth.json
containers.podman.podman_login:
username: user
password: 'p4ssw0rd'
- name: Login to quay.io and create ${XDG_RUNTIME_DIR}/containers/auth.json
containers.podman.podman_login:
username: user
password: 'p4ssw0rd'
registry: quay.io
- name: Login to quay.io using existing secret called password
containers.podman.podman_login:
username: user
secret: password
registry: quay.io