community.general.manageiq_tenant module – Management of tenants in ManageIQ.

Note

This module is part of the community.general collection (version 4.8.3).

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.manageiq_tenant.

Synopsis

  • The manageiq_tenant module supports adding, updating and deleting tenants in ManageIQ.

Requirements

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

Parameters

Parameter

Comments

description

string / required

The tenant description.

manageiq_connection

dictionary

ManageIQ connection configuration information.

ca_cert

aliases: ca_bundle_path

string

The path to a CA bundle file or directory with certificates. defaults to None.

password

string

ManageIQ password. MIQ_PASSWORD env var if set. otherwise, required if no token is passed in.

token

string

ManageIQ token. MIQ_TOKEN env var if set. otherwise, required if no username or password is passed in.

url

string

ManageIQ environment url. MIQ_URL env var if set. otherwise, it is required to pass it.

username

string

ManageIQ username. MIQ_USERNAME env var if set. otherwise, required if no token is passed in.

validate_certs

aliases: verify_ssl

boolean

Whether SSL certificates should be verified for HTTPS requests. defaults to True.

Choices:

  • no

  • yes ← (default)

name

string / required

The tenant name.

parent

string

The name of the parent tenant. If not supplied and no parent_id is supplied the root tenant is used.

parent_id

integer

The id of the parent tenant. If not supplied the root tenant is used.

The parent_id takes president over parent when supplied

quotas

dictionary

The tenant quotas.

All parameters case sensitive.

Valid attributes are:

  • cpu_allocated (int): use null to remove the quota.

  • mem_allocated (GB): use null to remove the quota.

  • storage_allocated (GB): use null to remove the quota.

  • vms_allocated (int): use null to remove the quota.

  • templates_allocated (int): use null to remove the quota.

state

string

absent - tenant should not exist, present - tenant should be.

Choices:

  • absent

  • present ← (default)

Examples

- name: Update the root tenant in ManageIQ
  community.general.manageiq_tenant:
    name: 'My Company'
    description: 'My company name'
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: False

- name: Create a tenant in ManageIQ
  community.general.manageiq_tenant:
    name: 'Dep1'
    description: 'Manufacturing department'
    parent_id: 1
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: False

- name: Delete a tenant in ManageIQ
  community.general.manageiq_tenant:
    state: 'absent'
    name: 'Dep1'
    parent_id: 1
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: False

- name: Set tenant quota for cpu_allocated, mem_allocated, remove quota for vms_allocated
  community.general.manageiq_tenant:
    name: 'Dep1'
    parent_id: 1
    quotas:
      - cpu_allocated: 100
      - mem_allocated: 50
      - vms_allocated: null
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: False


- name: Delete a tenant in ManageIQ using a token
  community.general.manageiq_tenant:
    state: 'absent'
    name: 'Dep1'
    parent_id: 1
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      token: 'sometoken'
      validate_certs: False

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

tenant

complex

The tenant.

Returned: success

description

string

The tenant description

Returned: success

id

integer

The tenant id

Returned: success

name

string

The tenant name

Returned: success

parent_id

integer

The id of the parent tenant

Returned: success

quotas

list / elements=string

List of tenant quotas

Returned: success

Sample: {“cpu_allocated”: 100, “mem_allocated”: 50}

Authors

  • Evert Mulder (@evertmulder)