theforeman.foreman.partition_table 模块 – 管理分区表模板
注意
此模块是 theforeman.foreman 集合(版本 4.2.0)的一部分。
如果您正在使用 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install theforeman.foreman
。您需要更多要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:theforeman.foreman.partition_table
。
theforeman.foreman 1.0.0 中的新增功能
概要
管理分区表模板
别名:foreman_ptable
要求
在执行此模块的主机上需要以下要求。
requests
参数
参数 |
注释 |
---|---|
要导入的模板文件的路径。 此项或 layout 是作为分区模板“内容”的源所必需的。 |
|
分区表模板的内容 此项或 file_name 是作为分区模板“内容”的源所必需的。 |
|
应将实体分配到的位置列表 |
|
确定是否应锁定模板 选择
|
|
分区表的名称。 如果省略,将从模板的 特殊值“*”可用于对所有现有分区表执行批量操作(修改、删除)。 |
|
应将实体分配到的组织列表 |
|
应为模板分配的操作系统系列。 选择
|
|
访问 Foreman 服务器的用户的密码。 如果未在任务中指定该值,则将使用环境变量 |
|
Foreman 服务器的 URL。 如果未在任务中指定该值,则将使用环境变量 |
|
实体的状态
选择
|
|
模板的新名称。设置此参数后,模块将不是幂等的。 |
|
访问 Foreman 服务器的用户名。 如果未在任务中指定该值,则将使用环境变量 |
|
是否验证 Foreman 服务器的 TLS 证书。 如果未在任务中指定该值,则将使用环境变量 选择
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持: 完全 |
可以在 check_mode 中运行,并返回已更改的状态预测,而无需修改实体 |
|
支持: 完全 |
在 diff 模式下,将返回有关已更改的内容(或可能需要在 check_mode 中更改的内容)的详细信息 |
示例
# Keep in mind, that in this case, the inline parameters will be overwritten
- name: "Create a Partition Table inline"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: A New Partition Template
state: present
layout: |
<%#
name: A Partition Template
%>
zerombr
clearpart --all --initlabel
autopart
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "Create a Partition Template from a file"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: timeywimey_template.erb
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "Delete a Partition Template"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: timeywimey
layout: |
<%#
dummy:
%>
state: absent
- name: "Create a Partition Template from a file and modify with parameter(s)"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: timeywimey_template.erb
name: Wibbly Wobbly Template
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
# Providing a name in this case wouldn't be very sensible.
# Alternatively make use of with_filetree to parse recursively with filter.
- name: "Parsing a directory of partition templates"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: "{{ item }}"
state: present
locations:
- SKARO
organizations:
- DALEK INC
with_fileglob:
- "./arsenal_templates/*.erb"
# If the templates are stored locally and the ansible module is executed on a remote host
- name: Ensure latest version of all Ptable Community Templates
theforeman.foreman.partition_table:
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
layout: '{{ lookup("file", item.src) }}'
with_filetree: '/path/to/partition/tables'
when: item.state == 'file'
# with name set to "*" bulk actions can be performed
- name: "Delete *ALL* partition tables"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "*"
state: absent
- name: "Assign all partition tables to the same organization(s)"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "*"
state: present
organizations:
- DALEK INC
- sky.net
- Doc Brown's garage
返回值
常用返回值在 此处 中记录,以下是此模块特有的字段
键 |
描述 |
---|---|
受影响实体的最终状态,按其类型分组。 已返回:成功 |
|
分区表列表。 已返回:成功 |