theforeman.foreman.host – Manage Hosts¶
Note
This plugin is part of the theforeman.foreman collection (version 1.5.1).
To install it use: ansible-galaxy collection install theforeman.foreman
.
To use it in a playbook, specify: theforeman.foreman.host
.
New in version 1.0.0: of theforeman.foreman
Parameters¶
Examples¶
- name: "Create a host"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
hostgroup: my_hostgroup
state: present
- name: "Create a host with build context"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
hostgroup: my_hostgroup
build: true
state: present
- name: "Create an unmanaged host"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
managed: false
state: present
- name: "Create a VM with 2 CPUs and 4GB RAM"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
compute_attributes:
cpus: 2
memory_mb: 4096
state: present
- name: "Create a VM and start it after creation"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
compute_attributes:
start: "1"
state: present
- name: "Create a VM on specific ovirt network"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
interfaces_attributes:
- type: "interface"
compute_attributes:
name: "nic1"
network: "969efbe6-f9e0-4383-a19a-a7ee65ad5007"
interface: "virtio"
state: present
- name: "Create a VM with 2 NICs on specific ovirt networks"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
interfaces_attributes:
- type: "interface"
primary: true
compute_attributes:
name: "nic1"
network: "969efbe6-f9e0-4383-a19a-a7ee65ad5007"
interface: "virtio"
- type: "interface"
name: "new_host_nic2"
managed: true
compute_attributes:
name: "nic2"
network: "969efbe6-f9e0-4383-a19a-a7ee65ad5008"
interface: "e1000"
state: present
- name: "Delete a host"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
state: absent
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | |
---|---|---|---|
entity
dictionary
|
success |
Final state of the affected entities grouped by their type.
|
|
hosts
list
/ elements=dictionary
|
success |
List of hosts.
|
Authors¶
Bernhard Hopfenmueller (@Fobhep) ATIX AG