community.general.one_image (8.5.0) — module

Manages OpenNebula images

Authors: Milan Ilic (@ilicmilan)

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 images


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Fetch the IMAGE by id
  community.general.one_image:
    id: 45
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Print the IMAGE properties
  ansible.builtin.debug:
    var: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Rename existing IMAGE
  community.general.one_image:
    id: 34
    state: renamed
    new_name: bar-image
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disable the IMAGE by id
  community.general.one_image:
    id: 37
    enabled: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable the IMAGE by name
  community.general.one_image:
    name: bar-image
    enabled: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Clone the IMAGE by name
  community.general.one_image:
    name: bar-image
    state: cloned
    new_name: bar-image-clone
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete the IMAGE by id
  community.general.one_image:
    id: '{{ result.id }}'
    state: absent

Inputs

    
id:
    description:
    - A O(id) of the image you would like to manage.
    type: int

name:
    description:
    - A O(name) of the image you would like to manage.
    type: str

state:
    choices:
    - present
    - absent
    - cloned
    - renamed
    default: present
    description:
    - V(present) - state that is used to manage the image
    - V(absent) - delete the image
    - V(cloned) - clone the image
    - V(renamed) - rename the image to the O(new_name)
    type: str

api_url:
    description:
    - 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 E(ONE_URL) environment variable is used.
    type: str

enabled:
    description:
    - Whether the image should be enabled or disabled.
    type: bool

new_name:
    description:
    - A name that will be assigned to the existing or new image.
    - In the case of cloning, by default O(new_name) will take the name of the origin
      image with the prefix 'Copy of'.
    type: str

api_password:
    description:
    - Password of the user to login into OpenNebula RPC server. If not set
    - then the value of the E(ONE_PASSWORD) environment variable is used.
    type: str

api_username:
    description:
    - Name of the user to login into the OpenNebula RPC server. If not set
    - then the value of the E(ONE_USERNAME) environment variable is used.
    type: str

Outputs

group_id:
  description: image's group id
  returned: success
  sample: 1
  type: int
group_name:
  description: image's group name
  returned: success
  sample: one-users
  type: str
id:
  description: image id
  returned: success
  sample: 153
  type: int
name:
  description: image name
  returned: success
  sample: app1
  type: str
owner_id:
  description: image's owner id
  returned: success
  sample: 143
  type: int
owner_name:
  description: image's owner name
  returned: success
  sample: ansible-test
  type: str
running_vms:
  description: count of running vms that use this image
  returned: success
  sample: 7
  type: int
state:
  description: state of image instance
  returned: success
  sample: READY
  type: str
used:
  description: is image in use
  returned: success
  sample: true
  type: bool