community.general.one_template 模块 – 管理 OpenNebula 模板
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible 包,则可能已经安装了此集合。 它不包含在 ansible-core 中。 要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。 您需要进一步的要求才能使用此模块,请参阅 要求 以了解详细信息。
要在 playbook 中使用它,请指定:community.general.one_template。
community.general 2.4.0 中的新增功能
概要
- 管理 OpenNebula 模板。 
要求
执行此模块的主机需要满足以下要求。
- pyone 
参数
| 参数 | 注释 | 
|---|---|
| 用于 XMLRPC 身份验证的密码或令牌。 如果未指定,则使用  | |
| XMLRPC 服务器的 ENDPOINT URL。 如果未指定,则使用  | |
| 用于 XMLRPC 身份验证的用户名。 如果未指定,则使用  | |
| 
 
 选择 
 | |
| 包含模板内容的字符串。 | |
| 是否验证 TLS/SSL 证书。 如果使用  选择 
 | |
| 等待达到所需状态的超时时间,以秒为单位。 默认值:  | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:部分 请注意,即使模板实际上不会更改,检查模式对于现有模板也始终返回  | 可以在  | |
| 支持:无 | 当处于差异模式时,将返回已更改(或可能需要在  | 
示例
- name: Fetch the TEMPLATE by id
  community.general.one_template:
    id: 6459
  register: result
- name: Print the TEMPLATE properties
  ansible.builtin.debug:
    var: result
- name: Fetch the TEMPLATE by name
  community.general.one_template:
    name: tf-prd-users-workerredis-p6379a
  register: result
- name: Create a new or update an existing TEMPLATE
  community.general.one_template:
    name: generic-opensuse
    template: |
      CONTEXT = [
        HOSTNAME = "generic-opensuse"
      ]
      CPU = "1"
      CUSTOM_ATTRIBUTE = ""
      DISK = [
        CACHE = "writeback",
        DEV_PREFIX = "sd",
        DISCARD = "unmap",
        IMAGE = "opensuse-leap-15.2",
        IMAGE_UNAME = "oneadmin",
        IO = "threads",
        SIZE = "" ]
      MEMORY = "2048"
      NIC = [
        MODEL = "virtio",
        NETWORK = "testnet",
        NETWORK_UNAME = "oneadmin" ]
      OS = [
        ARCH = "x86_64",
        BOOT = "disk0" ]
      SCHED_REQUIREMENTS = "CLUSTER_ID=\"100\""
      VCPU = "2"
- name: Delete the TEMPLATE by id
  community.general.one_template:
    id: 6459
    state: absent
返回值
常见的返回值在此处记录,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 已解析的模板 返回:当  | 
