community.general.one_image – Manages OpenNebula images
Note
This plugin is part of the community.general collection (version 3.8.1).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.one_image.
Synopsis
- Manages OpenNebula images
 
Requirements
The below requirements are needed on the host that executes this module.
- pyone
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
|   api_password    string    |    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    string    |    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    string    |    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    |   
  |    Whether the image should be enabled or disabled.   |  
|   id    integer    |    A   id of the image you would like to manage. |  |
|   name    string    |    A   name of the image you would like to manage. |  |
|   new_name    string    |    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    string    |   
  |   present - state that is used to manage the imageabsent - delete the imagecloned - clone the imagerenamed - rename the image to the new_name
 |  
Examples
- name: Fetch the IMAGE by id
  community.general.one_image:
    id: 45
  register: result
- name: Print the IMAGE properties
  ansible.builtin.debug:
    var: result
- name: Rename existing IMAGE
  community.general.one_image:
    id: 34
    state: renamed
    new_name: bar-image
- name: Disable the IMAGE by id
  community.general.one_image:
    id: 37
    enabled: no
- name: Enable the IMAGE by name
  community.general.one_image:
    name: bar-image
    enabled: yes
- name: Clone the IMAGE by name
  community.general.one_image:
    name: bar-image
    state: cloned
    new_name: bar-image-clone
  register: result
- name: Delete the IMAGE by id
  community.general.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   |  
Authors
- Milan Ilic (@ilicmilan)
 
    © 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
    https://docs.ansible.com/ansible/latest/collections/community/general/one_image_module.html