Problem:
I’m trying to use foreman-ansible-modules
to populate foreman with hosts from an ansible inventory, however when using the foreman_host
ansible module it requires several attributes that are missing but I can’t see how to add them.
Using the following task as an example:
- name: "Create host"
theforeman.foreman.foreman_host:
hostgroup: "Test_hostgroup"
location: "Default Location"
name: "Test_name"
organization: "Default Organization"
password: PASSWORD
server_url: SERVER_ADDRESS
state: present
username: USERNAME
When I run the play, I get the following errors:
"errors": {
"architecture_id": [
"can't be blank"
],
"interfaces.ip": [
"can't be blank"
],
"interfaces.ip6": [
"can't be blank"
],
"interfaces.mac": [
"can't be blank"
],
"operatingsystem_id": [
"can't be blank"
]
},
"full_messages": [
"Mac can't be blank",
"Ip can't be blank",
"Ip6 can't be blank",
"Operatingsystem can't be blank",
"Architecture can't be blank"
]
However, taking interfaces
for example, there’s no mention of how to add interfaces within the foreman_host
module - foreman_host – Manage Foreman hosts — Foreman Ansible Modules documentation
I’ve tried adding an interfaces list to the host like this:
- name: "Create host"
theforeman.foreman.foreman_host:
hostgroup: "Test_hostgroup"
interfaces:
- ip: IP_HERE
mac: MAC_HERE
subnet: SUBNET_HERE
location: "Default Location"
name: "Test_name"
organization: "Default Organization"
password: PASSWORD
server_url: SERVER_ADDRESS
state: present
username: USERNAME
But it then complains about unsupported parameters:
"Unsupported parameters for (theforeman.foreman.foreman_host) module: interfaces Supported parameters include: build, enabled, hostgroup, location, managed, name, organization, password, server_url, state, username, validate_certs"
How is this intended to work?
Any advice about an alternative method of populating foreman with a vast list of hosts/subnets/domains would also be welcomed if there is an easier/recommended method of doing this
Foreman and Proxy versions:
1.24.2