theforeman.foreman.snapshot 模块 – 管理快照
注意
此模块是 theforeman.foreman 集合 (版本 4.2.0) 的一部分。
如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install theforeman.foreman。您需要其他需求才能使用此模块,有关详细信息,请参阅 需求。
要在 playbook 中使用它,请指定:theforeman.foreman.snapshot。
theforeman.foreman 1.0.0 中的新增功能
概要
- 管理主机实体的快照 
- 此模块可以创建、更新、恢复和删除快照 
- 此模块需要在服务器上设置 foreman_snapshot_management 插件 
别名:foreman_snapshot
需求
以下是执行此模块的主机所需的条件。
- requests 
参数
| 参数 | 注释 | 
|---|---|
| 快照描述 | |
| 相关主机的名称 | |
| 快照 ID | |
| 添加 RAM 的选项(仅适用于 VMWare 计算资源) 选项 
 | |
| 快照名称 | |
| 访问 Foreman 服务器的用户的密码。 如果任务中未指定值,则将使用环境变量  | |
| Foreman 服务器的 URL。 如果任务中未指定值,则将使用环境变量  | |
| 快照状态 选项 
 | |
| 访问 Foreman 服务器的用户名。 如果任务中未指定值,则将使用环境变量  | |
| 是否验证 Foreman 服务器的 TLS 证书。 如果任务中未指定值,则将使用环境变量  选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全支持 | 可以在 check_mode 下运行并返回更改状态预测,而无需修改实体 | |
| 支持:完全支持 | 在 diff 模式下,将返回有关已更改内容(或可能需要在 check_mode 中更改的内容)的详细信息 | 
示例
- name: "Create a Snapshot"
  theforeman.foreman.snapshot:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "snapshot_before_software_upgrade"
    host: "server.example.com"
    state: present
- name: "Create Snapshots with same name"
  theforeman.foreman.snapshot:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "snapshot_before_software_upgrade"
    host: "server.example.com"
    state: new_snapshot
- name: "Update a Snapshot"
  theforeman.foreman.snapshot:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "snapshot_before_software_upgrade"
    host: "server.example.com"
    description: "description of snapshot"
    state: present
- name: "Update a Snapshot with same name"
  theforeman.foreman.snapshot:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "snapshot_before_software_upgrade"
    host: "server.example.com"
    description: "description of snapshot"
    state: present
    id: "snapshot-id"
- name: "Revert a Snapshot"
  theforeman.foreman.snapshot:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "snapshot_before_software_upgrade"
    host: "server.example.com"
    state: reverted
- name: "Delete a Snapshot"
  theforeman.foreman.snapshot:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "snapshot_before_software_upgrade"
    host: "server.example.com"
    state: absent
返回值
常见返回值已在 此处 记录,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 受影响实体的最终状态,按其类型分组。 返回:成功 | |
| 快照列表。 返回:成功 | 
