theforeman.foreman.compute_resource module – Manage Compute Resources
Note
This module is part of the theforeman.foreman collection (version 3.6.0).
To install it, use: ansible-galaxy collection install theforeman.foreman
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: theforeman.foreman.compute_resource
.
New in version 1.0.0: of theforeman.foreman
Synopsis
Create, update, and delete Compute Resources
Requirements
The below requirements are needed on the host that executes this module.
requests
Parameters
Parameter |
Comments |
---|---|
compute resource description |
|
List of locations the entity should be assigned to |
|
compute resource name |
|
List of organizations the entity should be assigned to |
|
Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
|
Compute resource provider. Required if state=present_with_defaults. Choices:
|
|
Parameter specific to compute resource provider. Required if state=present_with_defaults. |
|
AzureRM client id |
|
enable caching for provider=vmware Choices:
|
|
cloud for provider=AzureRm Choices:
|
|
Datacenter the compute resource is in, not valid for provider=libvirt |
|
Display type to use for the remote console, only valid for provider=libvirt |
|
Email for provider=GCE |
|
Certificate path for provider=GCE |
|
Default VNC Keyboard for provider=ovirt Choices:
|
|
oVirt quota ID, only valid for provider=ovirt |
|
Password for the compute resource connection, not valid for provider=libvirt |
|
Project id for provider=GCE |
|
X509 Certification Authorities, only valid for provider=ovirt |
|
AWS region, AZURE region |
|
Set a randomly generated password on the display connection for provider=vmware and provider=libvirt Choices:
|
|
verify ssl from provider provider=proxmox Choices:
|
|
Subscription ID for provider=AzureRm |
|
AzureRM tenant |
|
URL of the compute resource |
|
Use oVirt API v4, only valid for provider=ovirt Choices:
|
|
Username for the compute resource connection, not valid for provider=libvirt |
|
zone for provider=GCE |
|
URL of the Foreman server. If the value is not specified in the task, the value of environment variable |
|
State of the entity
Choices:
|
|
new compute resource name |
|
Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
|
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 Choices:
|
Examples
- name: Create livirt 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Final state of the affected entities grouped by their type. Returned: success |
|
List of compute resources. Returned: success |