Hi
I've been playing with cobbler triggers in an effort to tie cobbler into my distributed environment. My cobbler sits on my RHN Satellite...however I use Infoblox for dhcp & dns.
My initial attempt was the use of a bash script: /var/lib/cobbler/triggers/add/system/pre/create_dhcp_dns.sh
However I soon discovered that cobbler will ONLY pass $1 to the script, and does not pass on the MAC address ...which I obviously need to update the dhcp (Infoblox).
This is my cobbler add system command: cobbler system add --name=sparta --profile=uk-mserv-61-puppet:1:MarkitGroup --mac=00:50:56:92:1b:61 --hostname=sparta.mserv.local
I'm guessing a need to change my trigger to a python script, call the cobbler_api and then parse out the arguments...something like: /var/lib/cobbler/triggers/add/system/pre/create_dhcp_dns.py
create_dhcp_dns.py would parse the above cobbler command arguments, extract the mac address and hostname, obtain a new IP from Infoblox, update the dhcp and then continue the cobbler command...but now with the additional argument "--ip"
I have working perl scripts to obtain an IP from Infoblox and update the dhcp etc.....but I'm struggling to build them into my cobbler trigger. I could probably get away with a wrapper script that calls cobbler....but I would prefer to use cobbler directly and use triggers to do the back end work.
Is it possible....any examples?
Thanks Bruce
There are several good examples.
From a source checkout, look in cobbler/cobbler/modules
install_pre_puppet / install_post_puppet are pretty simple modules that are able to load system records and work with them, you should be able to adapt from there.
-Michael
On Fri, Nov 25, 2011 at 5:28 AM, bruce bushby bruce.bushby@gmail.com wrote:
Hi
I've been playing with cobbler triggers in an effort to tie cobbler into my distributed environment. My cobbler sits on my RHN Satellite...however I use Infoblox for dhcp & dns.
My initial attempt was the use of a bash script: /var/lib/cobbler/triggers/add/system/pre/create_dhcp_dns.sh
However I soon discovered that cobbler will ONLY pass $1 to the script, and does not pass on the MAC address ...which I obviously need to update the dhcp (Infoblox).
This is my cobbler add system command: cobbler system add --name=sparta --profile=uk-mserv-61-puppet:1:MarkitGroup --mac=00:50:56:92:1b:61 --hostname=sparta.mserv.local
I'm guessing a need to change my trigger to a python script, call the cobbler_api and then parse out the arguments...something like: /var/lib/cobbler/triggers/add/system/pre/create_dhcp_dns.py
create_dhcp_dns.py would parse the above cobbler command arguments, extract the mac address and hostname, obtain a new IP from Infoblox, update the dhcp and then continue the cobbler command...but now with the additional argument "--ip"
I have working perl scripts to obtain an IP from Infoblox and update the dhcp etc.....but I'm struggling to build them into my cobbler trigger. I could probably get away with a wrapper script that calls cobbler....but I would prefer to use cobbler directly and use triggers to do the back end work.
Is it possible....any examples?
Thanks Bruce _______________________________________________ cobbler mailing list cobbler@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/cobbler
cobbler@lists.fedorahosted.org