community.general.one_template – Manages OpenNebula templates

Note

This plugin is part of the community.general collection (version 3.6.0).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.one_template.

New in version 2.4.0: of community.general

Synopsis

  • Manages OpenNebula templates.

Requirements

The below requirements are needed on the host that executes this module.

  • pyone

Parameters

Parameter Choices/Defaults Comments
api_password
string
The password or token for XMLRPC authentication.
If not specified then the value of the ONE_PASSWORD environment variable, if any, is used.

aliases: api_token
api_url
string
The ENDPOINT URL of the XMLRPC server.
If not specified then the value of the ONE_URL environment variable, if any, is used.

aliases: api_endpoint
api_username
string
The name of the user for XMLRPC authentication.
If not specified then the value of the ONE_USERNAME environment variable, if any, is used.
id
integer
A id of the template you would like to manage. If not set then a
new template will be created with the given name.
name
string
A 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.
state
string
    Choices:
  • present ←
  • absent
present - state that is used to manage the template.
absent - delete the template.
template
string
A string containing the template contents.
validate_certs
boolean
    Choices:
  • no
  • yes ←
Whether to validate the SSL certificates or not.
This parameter is ignored if PYTHONHTTPSVERIFY environment variable is used.
wait_timeout
integer
Default:
300
Time to wait for the desired state to be reached before timeout, in seconds.

Notes

Note

  • Supports check_mode. Note that check mode always returns changed=true for existing templates, even if the template would not actually change.

Examples

- 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

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
group_id
integer
when state=present
template's group id

Sample:
1
group_name
string
when state=present
template's group name

Sample:
one-users
id
integer
when state=present
template id

Sample:
153
name
string
when state=present
template name

Sample:
app1
owner_id
integer
when state=present
template's owner id

Sample:
143
owner_name
string
when state=present
template's owner name

Sample:
ansible-test
template
dictionary
when state=present
the parsed template



Authors

  • Georg Gadinger (@nilsding)