Hi all! We are switching from Satellite to Foreman and I am trying to port over our server provisioning tools. We have Foreman (Version 1.21.0) setup and I’m able to provision a server using the GUI (Oracle Linux), but I’m having some trouble with the interfaces trying to use the API. Sorry if I’m missing something simple, but I’m pretty new to this technology and I’ve been driving myself crazy.
The flow is generally:
-
Pick a host that has been DIscovered
-
Provision the host:
curl -X PUT -s -k -u user:PASS -H ‘content-type: application/json’ -d ‘{“discovered_host”:{“environment_id”:1,“architecture_id”:1,“hostgroup_id”:2,“build”:“true”,“mac”:“dc:f4:aa:bb:10:aa”}}’ https://foreman.company.com/api/v2/discovered_hosts/macdcf4aabb10aa
This works fine. Then I try to configure the bond:
curl -X POST -s -k -u user:PASS -H 'content-type: application/json' -d '{"interface":{"name":"myserver.company.com","type":"Nic::Bond","ip":"10.111.111.111","identifier":"bond0.152","primary":"true","provision":"false","virtual":"true","managed":"true","attached_to":"bond0","mode":"active-backup","attached_devices":"eth0,eth1","tag":152,"subnet_id":3,"domain_id":1,"bond_options":"mode=1 primary=eth0 arp_ip_target=10.111.111.254 arp_interval=1000"}}' https://foreman.company.com/api/v2/hosts/macdcf4aabb10aa.company.com/interfaces
And I get:
"error": {"id":null,"errors":{"primary":["host already has primary interface"]},"full_messages":["Primary host already has primary interface"]}
I’ve tried a couple of variations of this, based on things I’ve read and saw in the log, but I can’t seem to get by this and it works OK in Satellite so I feel like I must be missing something.
Any help would be appreciated.