Centos – Kickoff Ansible Playbook after Cobbler install

ansiblecentoscobblerkickstart

I am working on implementing Cobbler and Ansible to do our server deploys and am having one final issue. My Ansible playbook works great, my Cobbler install works great, but the issue is in tying them together.

I wrote a post-install trigger for Cobbler that would kick off my Ansible playbooks based on the Cobbler profile used, the script works great when ran on its own. The issue is that for this to work the server needs to first be rebooted but Cobbler does post-install triggers before the first reboot. There is a "firstboot" trigger in Cobbler but I can not get this to work at all. It just simply never triggers even after the first boot.

If I try to run Ansible before the reboot the server just times out.

This is for CentOS 6.5, Ansible 1.6 and Cobbler 2.4

TLDR: How to get Cobbler "firstboot" trigger to work or how to successfully run Ansible Playbook after an install but before first reboot.

Any ideas?

Thanks!

Best Answer

Could you have a wrapper script in /etc/rc.local (or similar) that runs the Ansible playbook the first time the system boots, and then removes itself? Either with a rm $0 at the end of the script or by editing /etc/rc.local once complete?