Foreman-host-builder

Hi,

I'm writing a script for batch creating hosts in foreman. At the moment
it is only tested with vmware and ovirt backends but it'd be great to
have some more backends in and to begin developing the creation of other
objects like subnets, domains and so on. It uses David Caro's
python-foreman module to interface with the foreman api.

The module is called foreman-host-builder and you can find it at github
as well as at pypi.

To install:

pip install foreman-host-builder

Best Regards,

Xavier

Hi
I tried to host using foreman-host-builder.py
[root@ol07frm00 foreman-host-builder]# ./foreman-host-builder.py -t ol07tst18.yml
Building …
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
No handlers could be found for logger “foreman.client”

Getting parameters for servers…
Traceback (most recent call last):
File “./foreman-host-builder.py”, line 163, in
main(sys.argv[1:])
File “./foreman-host-builder.py”, line 75, in main
build_dict[‘location_id’] = foreman_api.locations.show(id=servers[server][‘location’])[‘id’]
KeyError: ‘location’

foreman version - 1.20.1

below is my config file
[foreman]
foreman_server = ol07frm00.sstech.com
foreman_username = admin
foreman_password = cGFzc3dvcmQ=
foreman_api_version = 2