gcore.cloud.image (1.0.1) — module

Manages images

Authors: GCore (@GCore)

Install collection

Install with ansible-galaxy collection install gcore.cloud:==1.0.1


Add to requirements.yml

  collections:
    - name: gcore.cloud
      version: 1.0.1

Description

Create/update/download or delete image

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new image
  gcore.cloud.image:
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    api_key: "{{ api_key }}"
    command: create
    name: "test-image"
    volume_id: "{{ volume_id }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Download new image
  gcore.cloud.image:
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    api_key: "{{ api_key }}"
    command: download
    name: "test-image"
    url: "{{ image_url }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Rename image
  gcore.cloud.image:
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    api_key: "{{ api_key }}"
    command: update
    image_id: "{{ image_id }}"
    name: "new-image-name"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete image
  gcore.cloud.image:
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    api_key: "{{ api_key }}"
    command: delete
    image_id: "{{ image_id }}"

Inputs

    
url:
    description:
    - Image url.
    - Used if I(command) is download
    required: false
    type: str

name:
    description:
    - Image name.
    - Used if I(command) is create or update
    required: false
    type: str

api_key:
    description:
    - GCore API auth key
    - Can be passed as I(CLOUD_API_KEY) environment variable.
    type: str

command:
    choices:
    - create
    - update
    - download
    - delete
    description:
    - Operation to perform.
    required: true
    type: str

os_type:
    choices:
    - linux
    - windows
    description:
    - The operating system installed on the image.
    - Used if I(command) is one of create, update or download.
    required: false
    type: str

ssh_key:
    choices:
    - allow
    - deny
    - required
    description:
    - Permission to use a ssh key in instances.
    - Used if I(command) is one of create, update or download.
    required: false
    type: str

api_host:
    default: https://api.gcore.com/cloud
    description:
    - GCore API base host
    - Can be passed as I(CLOUD_API_HOST) environment variable.
    type: str

image_id:
    description:
    - The ID of image.
    - Required if I(command) is one of update or delete
    required: false
    type: str

metadata:
    description:
    - Image metadata.
    - Used if I(command) is one of create, update or download.
    required: false
    type: dict

os_distro:
    description:
    - OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc.
    - Used if I(command) is download.
    required: false
    type: str

region_id:
    description:
    - GCore API region ID
    - Required if I(region_name) is not passed
    - Can be passed as I(CLOUD_REGION_ID) environment variable.
    type: int

volume_id:
    description:
    - Volume ID.
    - Required if I(command) is create
    required: false
    type: str

cow_format:
    description:
    - When True, image cannot be deleted unless all volumes, created from it, are deleted.
    - Used if I(command) is download.
    required: false
    type: bool

os_version:
    description:
    - OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian.
    - Used if I(command) is download.
    required: false
    type: str

project_id:
    description:
    - GCore API project ID
    - Required if I(project_name) is not passed
    - Can be passed as I(CLOUD_PROJECT_ID) environment variable.
    type: int

api_timeout:
    default: 30
    description:
    - Timeout in seconds to polling GCore API
    type: int

region_name:
    description:
    - GCore API region name
    - Required if I(region_id) is not passed
    - Can be passed as I(CLOUD_REGION_NAME) environment variable.
    type: str

architecture:
    choices:
    - aarch64
    - x86_64
    description:
    - An image architecture type.
    - Used if I(command) is one of create, update or download.
    required: false
    type: str

is_baremetal:
    description:
    - Set to true if the image will be used by baremetal instances. Defaults to false.
    - Used if I(command) is one of create, update or download.
    required: false
    type: bool

project_name:
    description:
    - GCore API project name
    - Required if I(project_id) is not passed
    - Can be passed as I(CLOUD_PROJECT_NAME) environment variable.
    type: str

hw_machine_type:
    choices:
    - i440
    - q35
    description:
    - A virtual chipset type.
    - Used if I(command) is one of create, update or download.
    required: false
    type: str

hw_firmware_type:
    choices:
    - bios
    - uefi
    description:
    - Specifies the type of firmware with which to boot the guest.
    - Used if I(command) is one of create, update or download.
    required: false
    type: str

Outputs

image:
  contains:
    architecture:
      description: A virtual chipset type.
      returned: always
      sample: x86_64
      type: str
    created_at:
      description: Datetime when the image was created
      returned: always
      sample: 2020-11-13T11:26:19+0000
      type: str
    creator_task_id:
      description: Image size in bytes
      returned: always
      sample: b10dd116-07f5-4225-abb7-f42da5cb78fb
      type: str
    description:
      description: Image description
      returned: always
      sample: test
      type: str
    disk_format:
      description: Disk format
      returned: always
      sample: raw
      type: str
    display_order:
      description: Display order
      returned: always
      sample: 2010
      type: int
    hw_firmware_type:
      description: Specifies the type of firmware with which to boot the guest.
      returned: always
      sample: bois
      type: str
    hw_machine_type:
      description: A virtual chipset type.
      returned: always
      sample: i440
      type: str
    id:
      description: Image ID
      returned: always
      sample: 726ecfcc-7fd0-4e30-a86e-7892524aa483
      type: str
    is_baremetal:
      description: Set to true if the image will be used by baremetal instances
      returned: always
      sample: false
      type: bool
    metadata:
      description: Image metadata.
      returned: always
      sample:
        key: value
      type: dict
    metadata_detailed:
      description: Detailed image metadata.
      returned: always
      sample:
      - key: key
        read_only: false
        value: value
      type: dict
    min_disk:
      description: Minimal boot volume required
      returned: always
      sample: 0
      type: int
    min_ram:
      description: Minimal VM RAM required
      returned: always
      sample: 0
      type: int
    name:
      description: Image name
      returned: always
      sample: 123
      type: str
    os_distro:
      description: OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc.
      returned: always
      sample: ubuntu
      type: str
    os_type:
      description: The operating system installed on the image.
      returned: always
      sample: linux
      type: str
    os_version:
      description: OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian.
      returned: always
      sample: '20.10'
      type: str
    project_id:
      description: Project ID
      returned: always
      sample: 1
      type: int
    region:
      description: Region name
      returned: always
      sample: Luxembourg 1
      type: str
    region_id:
      description: Region ID
      returned: always
      sample: 1
      type: int
    size:
      description: Image size in bytes
      returned: always
      sample: 2361393152
      type: int
    ssh_key:
      description: Whether the image supports SSH key or not
      elements: str
      returned: always
      sample: allow
      type: str
    status:
      description: Image status, i.e. active
      returned: always
      sample: 2019-06-19T11:56:16+0000
      type: str
    task_id:
      description: Active task. If None, action has been performed immediately in
        the request itself.
      returned: always
      sample: b10dd116-07f5-4225-abb7-f42da5cb78fb
      type: str
    updated_at:
      description: Datetime when the image was updated
      returned: if available
      sample: 2020-12-18T14:51:20+0000
      type: str
    visibility:
      description: Image visibility. Globally visible images are public
      returned: always
      sample: public
      type: str
  description:
  - Resource dictionary.
  returned: always
  type: complex

See also