To tie Ansible’s inventory to Cobbler, copy this script to /etc/ansible and chmod +x the file. Run cobblerd any time you use Ansible and use the -i command line option (e.g. -i /etc/ansible/cobbler.py) to communicate with Cobbler using Cobbler’s XMLRPC API.
Add a cobbler.ini file in /etc/ansible so Ansible knows where the Cobbler server is and some cache improvements can be used. For example:
[cobbler]
# Set Cobbler's hostname or IP address
host = http://127.0.0.1/cobbler_api
# API calls to Cobbler can be slow. For this reason, we cache the results of an API
# call. Set this to the path you want cache files to be written to. Two files
# will be written to this directory:
# - ansible-cobbler.cache
# - ansible-cobbler.index
cache_path = /tmp
# The number of seconds a cache file is considered valid. After this many
# seconds, a new API call will be made, and the cache file will be updated.
cache_max_age = 900