one_image – Manages OpenNebula images

New in version 2.6.

Synopsis

  • Manages OpenNebula images

Requirements

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

  • python-oca

Parameters

Parameter Choices/Defaults Comments
api_password
-
Password of the user to login into OpenNebula RPC server. If not set
then the value of the ONE_PASSWORD environment variable is used.
api_url
-
URL of the OpenNebula RPC server.
It is recommended to use HTTPS so that the username/password are not
transferred over the network unencrypted.
If not set then the value of the ONE_URL environment variable is used.
api_username
-
Name of the user to login into the OpenNebula RPC server. If not set
then the value of the ONE_USERNAME environment variable is used.
enabled
boolean
    Choices:
  • no
  • yes
Whether the image should be enabled or disabled.
id
-
A id of the image you would like to manage.
name
-
A name of the image you would like to manage.
new_name
-
A name that will be assigned to the existing or new image.
In the case of cloning, by default new_name will take the name of the origin image with the prefix 'Copy of'.
state
-
    Choices:
  • present
  • absent
  • cloned
  • renamed
present - state that is used to manage the image
absent - delete the image
cloned - clone the image
renamed - rename the image to the new_name

Examples

# Fetch the IMAGE by id
- one_image:
    id: 45
  register: result

# Print the IMAGE properties
- debug:
    msg: result

# Rename existing IMAGE
- one_image:
    id: 34
    state: renamed
    new_name: bar-image

# Disable the IMAGE by id
- one_image:
    id: 37
    enabled: no

# Enable the IMAGE by name
- one_image:
    name: bar-image
    enabled: yes

# Clone the IMAGE by name
- one_image:
    name: bar-image
    state: cloned
    new_name: bar-image-clone
  register: result

# Delete the IMAGE by id
- one_image:
    id: '{{ result.id }}'
    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
success
image's group id

Sample:
1
group_name
string
success
image's group name

Sample:
one-users
id
integer
success
image id

Sample:
153
name
string
success
image name

Sample:
app1
owner_id
integer
success
image's owner id

Sample:
143
owner_name
string
success
image's owner name

Sample:
ansible-test
running_vms
integer
success
count of running vms that use this image

Sample:
7
state
string
success
state of image instance

Sample:
READY
used
boolean
success
is image in use

Sample:
True


Status

Authors

  • Milan Ilic (@ilicmilan)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.8/modules/one_image_module.html