theforeman.foreman.foreman_compute_resource (0.8.1) — module

Manage Foreman Compute resources using Foreman API

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

preview | supported by community

Install collection

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


Add to requirements.yml

  collections:
    - name: theforeman.foreman
      version: 0.8.1

Description

Create, update and delete Foreman Compute Resources using Foreman API


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create livirt compute resource
  foreman_compute_resource:
    name: example_compute_resource
    locations:
      - Munich
    organizations:
      - ATIX
    provider: libvirt
    provider_params:
      url: libvirt.example.com
      display_type: vnc
    server_url: "https://foreman.example.com"
    username: admin
    password: secret
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update libvirt compute resource
  foreman_compute_resource:
    name: example_compute_resource
    description: updated compute resource
    locations:
      - Munich
    organizations:
      - ATIX
    provider: libvirt
    provider_params:
      url: libvirt.example.com
      display_type: vnc
    server_url: "https://foreman.example.com"
    username: admin
    password: secret
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete libvirt compute resource
  foreman_compute_resource:
    name: example_compute_resource
    server_url: "https://foreman.example.com"
    username: admin
    password: secret
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create vmware compute resource
  foreman_compute_resource:
    name: example_compute_resource
    locations:
      - Munich
    organizations:
      - ATIX
    provider: vmware
    provider_params:
      url: vsphere.example.com
      user: admin
      password: secret
      datacenter: ax01
    server_url: "https://foreman.example.com"
    username: admin
    password: secret
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create ovirt compute resource
  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: secret
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create proxmox compute resource
  foreman_compute_resource:
    name: proxmox_compute_resource
    locations:
      - Munich
    organizations:
      - ATIX
    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: secret
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create EC2 compute resource
  foreman_compute_resource:
    name: EC2_compute_resource
    description: EC2
    locations:
      - AWS
    organizations:
      - ATIX
    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: secret
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create Azure compute resource
  foreman_compute_resource:
    name: AzureRm_compute_resource
    description: AzureRm
    locations:
      - Azure
    organizations:
      - ATIX
    provider: AzureRm
    provider_params:
      user: SUBSCRIPTION_ID
      tenant: TENANT_ID
      app_ident: CLIENT_ID
      password: CLIENT_SECRET
      region: westeurope
    server_url: "https://foreman.example.com"
    username: admin
    password: secret
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create GCE compute resource
  foreman_compute_resource:
    name: GCE compute resource
    description: Google Cloud Engine
    locations:
      - GCE
    organizations:
      - ATIX
    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: secret
    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 in Foreman
    - 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
    required: true
    type: str

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

username:
    description: Username accessing the Foreman server
    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
    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:
    aliases:
    - verify_ssl
    default: true
    description: Whether or not to verify the TLS certificates of the Foreman server
    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
      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
      email:
        description:
        - Email for I(provider=GCE)
        type: str
      key_path:
        description:
        - Certificate path for I(provider=GCE)
        type: str
      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
      region:
        description:
        - AWS region, AZURE region
        type: str
      ssl_verify_peer:
        description:
        - verify ssl from provider I(provider=proxmox)
        type: bool
      tenant:
        description:
        - AzureRM tenant
        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