theforeman.foreman.content_import_library 模块 – 管理库内容导入
注意
此模块是 theforeman.foreman 集合 (版本 4.2.0) 的一部分。
如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install theforeman.foreman。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在 playbook 中使用它,请指定:theforeman.foreman.content_import_library。
theforeman.foreman 4.1.0 中的新增功能
摘要
- 导入库内容。 
要求
执行此模块的主机需要以下要求。
- requests 
参数
| 参数 | 注释 | 
|---|---|
| metadata.json 文件的内容。如果提供了 metadata_file 位置,则不需要此参数。 | |
| metadata.json 文件的位置。如果已通过其他参数提供 metadata,则不需要此参数。 | |
| 实体所属的组织 | |
| 访问 Foreman 服务器的用户密码。 如果任务中未指定此值,则将使用环境变量  | |
| 包含已导出存储库、版本或库的目录。 | |
| Foreman 服务器的 URL。 如果任务中未指定此值,则将使用环境变量  | |
| 访问 Foreman 服务器的用户名。 如果任务中未指定此值,则将使用环境变量  | |
| 是否验证 Foreman 服务器的 TLS 证书。 如果任务中未指定此值,则将使用环境变量  选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全支持 | 可以在 check_mode 下运行并返回更改状态预测,而无需修改实体 | |
| 支持:完全支持 | 在差异模式下,将返回有关已更改内容(或在 check_mode 下可能需要更改的内容)的详细信息 | 
示例
- name: "Import library content from metadata"
  theforeman.foreman.content_import_library:
    path: "/var/lib/pulp/imports/example-content"
    metadata: "{{ lookup('file', '/tmp/metadata.json') | from_json }}"
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    organization: "Default Organization"
- name: "Import library content with specific metadata json"
  theforeman.foreman.content_import_library:
    path: "/var/lib/pulp/imports/example-content"
    metadata_file: "/tmp/metadata.json"
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    organization: "Default Organization"
    destination_server: "airgapped.example.com"
    fail_on_missing_content: true
