community.general.cobbler_system 模块 – 在 Cobbler 中管理系统对象
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您正在使用 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。
要在剧本中使用它,请指定:community.general.cobbler_system。
概要
- 添加、修改或删除 Cobbler 中的系统 
参数
| 参数 | 注释 | 
|---|---|
| Cobbler 系统的名称或 IP 地址。 默认值:  | |
| 包含接口选项的字典列表。 | |
| 要管理的系统名称。 | |
| 登录 Cobbler 的密码。 | |
| 用于 REST 连接的端口号。 默认值取决于参数  | |
| 包含系统属性的字典。 | |
| 系统是否存在,不存在或进行查询。 选项 
 | |
| 同步更改。 并发同步 Cobbler 可能会失败。 选项 
 | |
| 如果  选项 
 | |
| 登录 Cobbler 的用户名。 默认值:  | |
| 如果  仅在使用自签名证书的个人控制站点上才应将其设置为  选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全支持 | 可以在  | |
| 支持:完全支持 | 在差异模式下,将返回有关已更改内容(或可能需要在  | 
备注
注意
- 并发同步 Cobbler 可能会导致奇怪的错误而失败。 
- 在 python 2.7.8 和更早版本(例如 RHEL7)上,您可能需要调整 python 行为以禁用证书验证。更多信息请访问 Python 标准库 HTTP 客户端中的证书验证。 
示例
- name: Ensure the system exists in Cobbler
  community.general.cobbler_system:
    host: cobbler01
    username: cobbler
    password: MySuperSecureP4sswOrd
    name: myhost
    properties:
      profile: CentOS6-x86_64
      name_servers: [ 2.3.4.5, 3.4.5.6 ]
      name_servers_search: foo.com, bar.com
    interfaces:
      eth0:
        macaddress: 00:01:02:03:04:05
        ipaddress: 1.2.3.4
  delegate_to: localhost
- name: Enable network boot in Cobbler
  community.general.cobbler_system:
    host: bdsol-aci-cobbler-01
    username: cobbler
    password: ins3965!
    name: bdsol-aci51-apic1.cisco.com
    properties:
      netboot_enabled: true
    state: present
  delegate_to: localhost
- name: Query all systems in Cobbler
  community.general.cobbler_system:
    host: cobbler01
    username: cobbler
    password: MySuperSecureP4sswOrd
    state: query
  register: cobbler_systems
  delegate_to: localhost
- name: Query a specific system in Cobbler
  community.general.cobbler_system:
    host: cobbler01
    username: cobbler
    password: MySuperSecureP4sswOrd
    name: '{{ inventory_hostname }}'
    state: query
  register: cobbler_properties
  delegate_to: localhost
- name: Ensure the system does not exist in Cobbler
  community.general.cobbler_system:
    host: cobbler01
    username: cobbler
    password: MySuperSecureP4sswOrd
    name: myhost
    state: absent
  delegate_to: localhost
返回值
常见的返回值已在此处 记录,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 我们正在使用的系统信息(结果) 返回:当提供  | |
| 系统列表 返回:  | 
