pkubica.ovirt.ovirt_storage_domain (1.4.3) — module

Module to manage storage domains in oVirt/RHV

| "added in version" 1.0.0 of pkubica.ovirt"

Authors: Ondra Machacek (@machacekondra), Martin Necas (@mnecas)

Install collection

Install with ansible-galaxy collection install pkubica.ovirt:==1.4.3


Add to requirements.yml

  collections:
    - name: pkubica.ovirt
      version: 1.4.3

Description

Module to manage storage domains in oVirt/RHV


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Examples don't contain auth parameter for simplicity,
# look at ovirt_auth module to see how to reuse authentication:

# Add data NFS storage domain
- pkubica.ovirt.ovirt_storage_domain:
    name: data_nfs
    host: myhost
    data_center: mydatacenter
    nfs:
      address: 10.34.63.199
      path: /path/data
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add data NFS storage domain with id for data center
- pkubica.ovirt.ovirt_storage_domain:
    name: data_nfs
    host: myhost
    data_center: 11111
    nfs:
      address: 10.34.63.199
      path: /path/data
      mount_options: noexec,nosuid
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add data localfs storage domain
- pkubica.ovirt.ovirt_storage_domain:
    name: data_localfs
    host: myhost
    data_center: mydatacenter
    localfs:
      path: /path/to/data
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add data iSCSI storage domain:
- pkubica.ovirt.ovirt_storage_domain:
    name: data_iscsi
    host: myhost
    data_center: mydatacenter
    iscsi:
      target: iqn.2016-08-09.domain-01:nickname
      lun_id:
       - 1IET_000d0001
       - 1IET_000d0002
      address: 10.34.63.204
    discard_after_delete: True
    backup: False
    critical_space_action_blocker: 5
    warning_low_space: 10
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Since Ansible 2.5 you can specify multiple targets for storage domain,
# Add data iSCSI storage domain with multiple targets:
- pkubica.ovirt.ovirt_storage_domain:
    name: data_iscsi
    host: myhost
    data_center: mydatacenter
    iscsi:
      target_lun_map:
        - target: iqn.2016-08-09.domain-01:nickname
          lun_id: 1IET_000d0001
        - target: iqn.2016-08-09.domain-02:nickname
          lun_id: 1IET_000d0002
      address: 10.34.63.204
    discard_after_delete: True
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add data glusterfs storage domain
- pkubica.ovirt.ovirt_storage_domain:
    name: glusterfs_1
    host: myhost
    data_center: mydatacenter
    glusterfs:
      address: 10.10.10.10
      path: /path/data
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create export NFS storage domain:
- pkubica.ovirt.ovirt_storage_domain:
    name: myexportdomain
    domain_function: export
    host: myhost
    data_center: mydatacenter
    nfs:
      address: 10.34.63.199
      path: /path/export
    wipe_after_delete: False
    backup: True
    critical_space_action_blocker: 2
    warning_low_space: 5
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Import export NFS storage domain:
- pkubica.ovirt.ovirt_storage_domain:
    state: imported
    domain_function: export
    host: myhost
    data_center: mydatacenter
    nfs:
      address: 10.34.63.199
      path: /path/export
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Import FCP storage domain:
- pkubica.ovirt.ovirt_storage_domain:
    state: imported
    name: data_fcp
    host: myhost
    data_center: mydatacenter
    fcp: {}
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Update OVF_STORE:
- pkubica.ovirt.ovirt_storage_domain:
    state: update_ovf_store
    name: domain
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create ISO NFS storage domain
- pkubica.ovirt.ovirt_storage_domain:
    name: myiso
    domain_function: iso
    host: myhost
    data_center: mydatacenter
    nfs:
      address: 10.34.63.199
      path: /path/iso
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create managed storage domain
# Available from ovirt 4.3 and ansible 2.9
- pkubica.ovirt.ovirt_storage_domain:
    name: my_managed_domain
    host: myhost
    data_center: mydatacenter
    managed_block_storage:
      driver_options:
        - name: rbd_pool
          value: pool1
        - name: rbd_user
          value: admin
        - name: volume_driver
          value: cinder.volume.drivers.rbd.RBDDriver
        - name: rbd_keyring_conf
          value: /etc/ceph/keyring
      driver_sensitive_options:
        - name: secret_password
          value: password
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove storage domain
- pkubica.ovirt.ovirt_storage_domain:
    state: absent
    name: mystorage_domain
    format: true

Inputs

    
id:
    description:
    - Id of the storage domain to be imported.
    type: str

fcp:
    description:
    - 'Dictionary with values for fibre channel storage type:'
    - Note that these parameters are not idempotent.
    suboptions:
      lun_id:
        description:
        - LUN id.
      override_luns:
        description:
        - If I(True) FCP storage domain LUNs will be overridden before adding.
        type: bool
    type: dict

nfs:
    description:
    - 'Dictionary with values for NFS storage type:'
    - Note that these parameters are not idempotent.
    suboptions:
      address:
        description:
        - 'Address of the NFS server. E.g.: myserver.mydomain.com'
      mount_options:
        description:
        - Option which will be passed when mounting storage.
      path:
        description:
        - 'Path of the mount point. E.g.: /path/to/my/data'
      retrans:
        description:
        - The number of times to retry a request before attempting further recovery actions.
          Range 0 to 65535.
      timeout:
        description:
        - The time in tenths of a second to wait for a response before retrying NFS requests.
          Range 0 to 65535.
      version:
        description:
        - 'NFS version. One of: I(auto), I(v3), I(v4) or I(v4_1).'
    type: dict

auth:
    description:
    - 'Dictionary with values needed to create HTTP/HTTPS connection to oVirt:'
    required: true
    suboptions:
      ca_file:
        description:
        - A PEM file containing the trusted CA certificates.
        - The certificate presented by the server will be verified using these CA certificates.
        - If C(ca_file) parameter is not set, system wide CA certificate store is used.
        - Default value is set by C(OVIRT_CAFILE) environment variable.
        type: str
      compress:
        default: true
        description: Flag indicating if compression is used for connection.
        type: bool
      headers:
        description:
        - Dictionary of HTTP headers to be added to each API call.
        type: dict
      hostname:
        description:
        - A string containing the hostname of the server, usually something like `I(server.example.com)`.
        - Default value is set by C(OVIRT_HOSTNAME) environment variable.
        - Either C(url) or C(hostname) is required.
        type: str
      insecure:
        description:
        - A boolean flag that indicates if the server TLS certificate and host name should
          be checked.
        type: bool
      kerberos:
        description:
        - A boolean flag indicating if Kerberos authentication should be used instead
          of the default basic authentication.
        type: bool
      password:
        description:
        - The password of the user.
        - Default value is set by C(OVIRT_PASSWORD) environment variable.
        required: true
        type: str
      timeout:
        description: Number of seconds to wait for response.
        type: int
      token:
        description:
        - Token to be used instead of login with username/password.
        - Default value is set by C(OVIRT_TOKEN) environment variable.
        type: str
      url:
        description:
        - A string containing the API URL of the server, usually something like `I(https://server.example.com/ovirt-engine/api)`.
        - Default value is set by C(OVIRT_URL) environment variable.
        - Either C(url) or C(hostname) is required.
        type: str
      username:
        description:
        - The name of the user, something like I(admin@internal).
        - Default value is set by C(OVIRT_USERNAME) environment variable.
        required: true
        type: str
    type: dict

host:
    description:
    - Host to be used to mount storage.
    type: str

name:
    description:
    - Name of the storage domain to manage. (Not required when state is I(imported))
    type: str

wait:
    default: true
    description:
    - C(yes) if the module should wait for the entity to get into desired state.
    type: bool

iscsi:
    description:
    - 'Dictionary with values for iSCSI storage type:'
    - Note that these parameters are not idempotent.
    suboptions:
      address:
        description:
        - Address of the iSCSI storage server.
      lun_id:
        description:
        - LUN id(s).
      override_luns:
        description:
        - If I(True) ISCSI storage domain luns will be overridden before adding.
        type: bool
      password:
        description:
        - A CHAP password for logging into a target.
      port:
        description:
        - Port of the iSCSI storage server.
      target:
        description:
        - The target IQN for the storage device.
      target_lun_map:
        description:
        - List of dictionary containing targets and LUNs.
      username:
        description:
        - A CHAP user name for logging into a target.
    type: dict

state:
    choices:
    - present
    - absent
    - maintenance
    - unattached
    - imported
    - update_ovf_store
    default: present
    description:
    - Should the storage domain be present/absent/maintenance/unattached/imported/update_ovf_store
    - I(imported) is supported since version 2.4.
    - I(update_ovf_store) is supported since version 2.5, currently if C(wait) is (true),
      we don't wait for update.
    type: str

backup:
    description:
    - Boolean flag which indicates whether the storage domain is configured as backup
      or not.
    type: bool

format:
    description:
    - If I(True) storage domain will be formatted after removing it from oVirt/RHV.
    - This parameter is relevant only when C(state) is I(absent).
    type: bool

comment:
    description:
    - Comment of the storage domain.
    type: str

destroy:
    description:
    - Logical remove of the storage domain. If I(true) retains the storage domain's data
      for import.
    - This parameter is relevant only when C(state) is I(absent).
    type: bool

localfs:
    description:
    - 'Dictionary with values for localfs storage type:'
    - Note that these parameters are not idempotent.
    suboptions:
      path:
        description:
        - 'Path of the mount point. E.g.: /path/to/my/data'
    type: dict

posixfs:
    description:
    - 'Dictionary with values for PosixFS storage type:'
    - Note that these parameters are not idempotent.
    suboptions:
      mount_options:
        description:
        - Option which will be passed when mounting storage.
      path:
        description:
        - 'Path of the mount point. E.g.: /path/to/my/data'
      vfs_type:
        description:
        - Virtual File System type.
    type: dict

timeout:
    default: 180
    description:
    - The amount of time in seconds the module should wait for the instance to get into
      desired state.
    type: int

glusterfs:
    description:
    - 'Dictionary with values for GlusterFS storage type:'
    - Note that these parameters are not idempotent.
    suboptions:
      address:
        description:
        - 'Address of the Gluster server. E.g.: myserver.mydomain.com'
      mount_options:
        description:
        - Option which will be passed when mounting storage.
      path:
        description:
        - 'Path of the mount point. E.g.: /path/to/my/data'
    type: dict

data_center:
    description:
    - Data center name where storage domain should be attached.
    - This parameter isn't idempotent, it's not possible to change data center of storage
      domain.
    type: str

description:
    description:
    - Description of the storage domain.
    type: str

fetch_nested:
    description:
    - If I(True) the module will fetch additional data from the API.
    - It will fetch IDs of the VMs disks, snapshots, etc. User can configure to fetch
      other attributes of the nested entities by specifying C(nested_attributes).
    type: bool

poll_interval:
    default: 3
    description:
    - Number of the seconds the module waits until another poll request on entity status
      is sent.
    type: int

domain_function:
    aliases:
    - type
    choices:
    - data
    - iso
    - export
    default: data
    description:
    - Function of the storage domain.
    - This parameter isn't idempotent, it's not possible to change domain function of
      storage domain.
    type: str

nested_attributes:
    description:
    - Specifies list of the attributes which should be fetched from the API.
    - This parameter apply only when C(fetch_nested) is I(true).
    elements: str
    type: list

warning_low_space:
    description:
    - Indicates the minimum percentage of a free space in a storage domain to present
      a warning.
    type: int

wipe_after_delete:
    description:
    - Boolean flag which indicates whether the storage domain should wipe the data after
      delete.
    type: bool

discard_after_delete:
    description:
    - If I(True) storage domain blocks will be discarded upon deletion. Enabled by default.
    - This parameter is relevant only for block based storage domains.
    type: bool

managed_block_storage:
    description:
    - Dictionary with values for managed block storage type
    - 'Note: available from ovirt 4.3'
    suboptions:
      driver_options:
        description:
        - The options to be passed when creating a storage domain using a cinder driver.
        - List of dictionary containing C(name) and C(value) of driver option
        elements: dict
        type: list
      driver_sensitive_options:
        description:
        - Parameters containing sensitive information, to be passed when creating a storage
          domain using a cinder driver.
        - List of dictionary containing C(name) and C(value) of driver sensitive option
        elements: dict
        type: list
    type: dict

critical_space_action_blocker:
    description:
    - Indicates the minimal free space the storage domain should contain in percentages.
    type: int

Outputs

id:
  description: ID of the storage domain which is managed
  returned: On success if storage domain is found.
  sample: 7de90f31-222c-436c-a1ca-7e655bd5b60c
  type: str
storage_domain:
  description: 'Dictionary of all the storage domain attributes. Storage domain attributes
    can be found on your oVirt/RHV instance at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/storage_domain.'
  returned: On success if storage domain is found.
  type: dict