theforeman.foreman.compute_resource (4.0.0) — module

Manage Compute Resources

| "added in version" 1.0.0 of theforeman.foreman"

Authors: Philipp Joos (@philippj), Baptiste Agasse (@bagasse), Manisha Singhal (@Manisha15) ATIX AG, Mark Hlawatschek (@hlawatschek) ATIX AG

Install collection

Install with ansible-galaxy collection install theforeman.foreman:==4.0.0


Add to requirements.yml

  collections:
    - name: theforeman.foreman
      version: 4.0.0

Description

Create, update, and delete Compute Resources


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create libvirt compute resource
  theforeman.foreman.compute_resource:
    name: example_compute_resource
    locations:
      - Munich
    organizations:
      - ACME
    provider: libvirt
    provider_params:
      url: qemu+ssh://root@libvirt.example.com/system
      display_type: spice
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update libvirt compute resource
  theforeman.foreman.compute_resource:
    name: example_compute_resource
    description: updated compute resource
    locations:
      - Munich
    organizations:
      - ACME
    provider: libvirt
    provider_params:
      url: qemu+ssh://root@libvirt.example.com/system
      display_type: spice
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete libvirt compute resource
  theforeman.foreman.compute_resource:
    name: example_compute_resource
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create vmware compute resource
  theforeman.foreman.compute_resource:
    name: example_compute_resource
    locations:
      - Munich
    organizations:
      - ACME
    provider: vmware
    provider_params:
      caching_enabled: false
      url: vsphere.example.com
      user: admin
      password: secret
      datacenter: ax01
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create ovirt compute resource
  theforeman.foreman.compute_resource:
    name: ovirt_compute_resource
    locations:
      - France/Toulouse
    organizations:
      - Example Org
    provider: ovirt
    provider_params:
      url: ovirt.example.com
      user: ovirt-admin@example.com
      password: ovirtsecret
      datacenter: aa92fb54-0736-4066-8fa8-b8b9e3bd75ac
      ovirt_quota: 24868ab9-c2a1-47c3-87e7-706f17d215ac
      use_v4: true
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create proxmox compute resource
  theforeman.foreman.compute_resource:
    name: proxmox_compute_resource
    locations:
      - Munich
    organizations:
      - ACME
    provider: proxmox
    provider_params:
      url: https://proxmox.example.com:8006/api2/json
      user: root@pam
      password: secretpassword
      ssl_verify_peer: true
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create EC2 compute resource
  theforeman.foreman.compute_resource:
    name: EC2_compute_resource
    description: EC2
    locations:
      - AWS
    organizations:
      - ACME
    provider: EC2
    provider_params:
      user: AWS_ACCESS_KEY
      password: AWS_SECRET_KEY
      region: eu-west-1
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create Azure compute resource
  theforeman.foreman.compute_resource:
    name: AzureRm_compute_resource
    description: AzureRm
    locations:
      - Azure
    organizations:
      - ACME
    provider: AzureRm
    provider_params:
      sub_id: SUBSCRIPTION_ID
      tenant: TENANT_ID
      app_ident: CLIENT_ID
      password: CLIENT_SECRET
      region: westeurope
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create GCE compute resource
  theforeman.foreman.compute_resource:
    name: GCE compute resource
    description: Google Cloud Engine
    locations:
      - GCE
    organizations:
      - ACME
    provider: GCE
    provider_params:
      project: orcharhino
      email: myname@atix.de
      key_path: "/usr/share/foreman/gce_orcharhino_key.json"
      zone: europe-west3-b
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create Openstack compute resource
  theforeman.foreman.compute_resource:
    name: Openstack compute resource
    description: Openstack
    locations:
      - DC1
    organizations:
      - ACME
    provider: Openstack
    provider_params:
      url: "https://Openstack.example.com:5000/v3"
      user: admin
      password: secret
      tenant: "MyProject"
      domain: "example.com"
      project_domain_name: "example.com"
      project_domain_id: "0123456789a0123456789b0123456789"
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present

Inputs

    
name:
    description: compute resource name
    required: true
    type: str

state:
    choices:
    - present
    - present_with_defaults
    - absent
    default: present
    description:
    - State of the entity
    - C(present_with_defaults) will ensure the entity exists, but won't update existing
      ones
    type: str

password:
    description:
    - Password of the user accessing the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_PASSWORD)
      will be used instead.
    required: true
    type: str

provider:
    choices:
    - vmware
    - libvirt
    - ovirt
    - proxmox
    - EC2
    - AzureRm
    - GCE
    - Openstack
    description: Compute resource provider. Required if I(state=present_with_defaults).
    required: false
    type: str

username:
    description:
    - Username accessing the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_USERNAME)
      will be used instead.
    required: true
    type: str

locations:
    description: List of locations the entity should be assigned to
    elements: str
    type: list

server_url:
    description:
    - URL of the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_SERVER_URL)
      will be used instead.
    required: true
    type: str

description:
    description: compute resource description
    required: false
    type: str

updated_name:
    description: new compute resource name
    required: false
    type: str

organizations:
    description: List of organizations the entity should be assigned to
    elements: str
    type: list

validate_certs:
    default: true
    description:
    - Whether or not to verify the TLS certificates of the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_VALIDATE_CERTS)
      will be used instead.
    type: bool

provider_params:
    description: Parameter specific to compute resource provider. Required if I(state=present_with_defaults).
    required: false
    suboptions:
      app_ident:
        description:
        - AzureRM client id
        type: str
      caching_enabled:
        description:
        - enable caching for I(provider=vmware)
        type: bool
      cloud:
        choices:
        - azure
        - azureusgovernment
        - azurechina
        - azuregermancloud
        description:
        - cloud for I(provider=AzureRm)
        type: str
        version_added: 2.1.0
        version_added_collection: theforeman.foreman
      datacenter:
        description:
        - Datacenter the compute resource is in, not valid for I(provider=libvirt)
        type: str
      display_type:
        description:
        - Display type to use for the remote console, only valid for I(provider=libvirt)
        type: str
      domain:
        description:
        - Auth domain for users, only valid for I(provider=Openstack)
        type: str
      email:
        description:
        - Email for I(provider=GCE)
        type: str
      key_path:
        description:
        - Certificate path for I(provider=GCE)
        type: str
      keyboard_layout:
        choices:
        - ar
        - da
        - de
        - de-ch
        - en-gb
        - en-us
        - es
        - et
        - fi
        - fo
        - fr
        - fr-be
        - fr-ca
        - fr-ch
        - hr
        - hu
        - is
        - it
        - ja
        - lt
        - lv
        - mk
        - nl
        - nl-be
        - 'no'
        - pl
        - pt
        - pt-br
        - ru
        - sl
        - sv
        - th
        - tr
        description:
        - Default VNC Keyboard for I(provider=ovirt)
        type: str
        version_added: 2.0.0
        version_added_collection: theforeman.foreman
      ovirt_quota:
        description:
        - oVirt quota ID, only valid for I(provider=ovirt)
        type: str
      password:
        description:
        - Password for the compute resource connection, not valid for I(provider=libvirt)
        type: str
      project:
        description:
        - Project id for I(provider=GCE)
        type: str
      project_domain_id:
        description:
        - Project domain id, only valid for I(provider=Openstack)
        type: str
      project_domain_name:
        description:
        - Project domain name, only valid for I(provider=Openstack)
        type: str
      public_key:
        description:
        - X509 Certification Authorities, only valid for I(provider=ovirt)
        type: str
        version_added: 2.0.0
        version_added_collection: theforeman.foreman
      region:
        description:
        - AWS region, AZURE region
        type: str
      set_console_password:
        description:
        - Set a randomly generated password on the display connection for I(provider=vmware)
          and I(provider=libvirt)
        type: bool
        version_added: 2.0.0
        version_added_collection: theforeman.foreman
      ssl_verify_peer:
        description:
        - verify ssl from provider I(provider=proxmox)
        type: bool
      sub_id:
        description:
        - Subscription ID for I(provider=AzureRm)
        type: str
        version_added: 2.1.0
        version_added_collection: theforeman.foreman
      tenant:
        description:
        - AzureRM tenant, Openstack project name
        type: str
      url:
        description:
        - URL of the compute resource
        type: str
      use_v4:
        description:
        - Use oVirt API v4, only valid for I(provider=ovirt)
        type: bool
      user:
        description:
        - Username for the compute resource connection, not valid for I(provider=libvirt)
        type: str
      zone:
        description:
        - zone for I(provider=GCE)
        type: str
    type: dict

Outputs

entity:
  contains:
    compute_resources:
      description: List of compute resources.
      elements: dict
      type: list
  description: Final state of the affected entities grouped by their type.
  returned: success
  type: dict