community.general.one_template (8.5.0) — module

Manages OpenNebula templates

| "added in version" 2.4.0 of community.general"

Authors: Georg Gadinger (@nilsding)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manages OpenNebula templates.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Fetch the TEMPLATE by id
  community.general.one_template:
    id: 6459
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Print the TEMPLATE properties
  ansible.builtin.debug:
    var: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Fetch the TEMPLATE by name
  community.general.one_template:
    name: tf-prd-users-workerredis-p6379a
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete the TEMPLATE by id
  community.general.one_template:
    id: 6459
    state: absent

Inputs

    
id:
    description:
    - A O(id) of the template you would like to manage.  If not set then a
    - new template will be created with the given O(name).
    type: int

name:
    description:
    - A O(name) of the template you would like to manage.  If a template with
    - the given name does not exist it will be created, otherwise it will be
    - managed by this module.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - V(present) - state that is used to manage the template.
    - V(absent) - delete the template.
    type: str

api_url:
    aliases:
    - api_endpoint
    description:
    - The ENDPOINT URL of the XMLRPC server.
    - If not specified then the value of the E(ONE_URL) environment variable, if any,
      is used.
    type: str

template:
    description:
    - A string containing the template contents.
    type: str

api_password:
    aliases:
    - api_token
    description:
    - The password or token for XMLRPC authentication.
    - If not specified then the value of the E(ONE_PASSWORD) environment variable, if
      any, is used.
    type: str

api_username:
    description:
    - The name of the user for XMLRPC authentication.
    - If not specified then the value of the E(ONE_USERNAME) environment variable, if
      any, is used.
    type: str

wait_timeout:
    default: 300
    description:
    - Time to wait for the desired state to be reached before timeout, in seconds.
    type: int

validate_certs:
    default: true
    description:
    - Whether to validate the TLS/SSL certificates or not.
    - This parameter is ignored if E(PYTHONHTTPSVERIFY) environment variable is used.
    type: bool

Outputs

group_id:
  description: template's group id
  returned: when O(state=present)
  sample: 1
  type: int
group_name:
  description: template's group name
  returned: when O(state=present)
  sample: one-users
  type: str
id:
  description: template id
  returned: when O(state=present)
  sample: 153
  type: int
name:
  description: template name
  returned: when O(state=present)
  sample: app1
  type: str
owner_id:
  description: template's owner id
  returned: when O(state=present)
  sample: 143
  type: int
owner_name:
  description: template's owner name
  returned: when O(state=present)
  sample: ansible-test
  type: str
template:
  description: the parsed template
  returned: when O(state=present)
  type: dict