community.general.manageiq_tenant (8.5.0) — module

Management of tenants in ManageIQ

Authors: Evert Mulder (@evertmulder)

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

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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  # only do this when you trust the network!
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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  # only do this when you trust the network!
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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  # only do this when you trust the network!
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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  # only do this when you trust the network!
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

- 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  # only do this when you trust the network!

Inputs

    
name:
    default: null
    description:
    - The tenant name.
    required: true
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description:
    - absent - tenant should not exist, present - tenant should be.
    type: str

parent:
    default: null
    description:
    - The name of the parent tenant. If not supplied and no O(parent_id) is supplied the
      root tenant is used.
    required: false
    type: str

quotas:
    default: {}
    description:
    - The tenant quotas.
    - All parameters case sensitive.
    - 'Valid attributes are:'
    - ' - C(cpu_allocated) (int): use null to remove the quota.'
    - ' - C(mem_allocated) (GB): use null to remove the quota.'
    - ' - C(storage_allocated) (GB): use null to remove the quota.'
    - ' - C(vms_allocated) (int): use null to remove the quota.'
    - ' - C(templates_allocated) (int): use null to remove the quota.'
    required: false
    type: dict

parent_id:
    default: null
    description:
    - The id of the parent tenant. If not supplied the root tenant is used.
    - The O(parent_id) takes president over O(parent) when supplied
    required: false
    type: int

description:
    default: null
    description:
    - The tenant description.
    required: true
    type: str

manageiq_connection:
    description:
    - ManageIQ connection configuration information.
    required: false
    suboptions:
      ca_cert:
        aliases:
        - ca_bundle_path
        description:
        - The path to a CA bundle file or directory with certificates.
        type: str
      password:
        description:
        - ManageIQ password. E(MIQ_PASSWORD) environment variable if set. Otherwise, required
          if no token is passed in.
        type: str
      token:
        description:
        - ManageIQ token. E(MIQ_TOKEN) environment variable if set. Otherwise, required
          if no username or password is passed in.
        type: str
      url:
        description:
        - ManageIQ environment URL. E(MIQ_URL) environment variable if set. Otherwise,
          it is required to pass it.
        required: false
        type: str
      username:
        description:
        - ManageIQ username. E(MIQ_USERNAME) environment variable if set. Otherwise, required
          if no token is passed in.
        type: str
      validate_certs:
        aliases:
        - verify_ssl
        default: true
        description:
        - Whether SSL certificates should be verified for HTTPS requests.
        type: bool
    type: dict

Outputs

tenant:
  contains:
    description:
      description: The tenant description
      returned: success
      type: str
    id:
      description: The tenant id
      returned: success
      type: int
    name:
      description: The tenant name
      returned: success
      type: str
    parent_id:
      description: The id of the parent tenant
      returned: success
      type: int
    quotas:
      description: List of tenant quotas
      returned: success
      sample:
        cpu_allocated: 100
        mem_allocated: 50
      type: list
  description: The tenant.
  returned: success
  type: complex