theforeman.foreman.host – Manage Hosts¶
Note
This plugin is part of the theforeman.foreman collection.
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: "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