# Orchestration between OS Provisioning and Configuration Management (Barrier Behavior between Cobbler and Ansible)

**URL:** <https://forum.ansible.com/t/orchestration-between-os-provisioning-and-configuration-management-barrier-behavior-between-cobbler-and-ansible/15070>\
**Category:** Ansible Project\
**Created:** [April 23, 2014, 1:59am UTC](https://forum.ansible.com/t/orchestration-between-os-provisioning-and-configuration-management-barrier-behavior-between-cobbler-and-ansible/15070 "2014-04-23T01:59:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@Sean](https://forum.ansible.com/u/Sean)\
**Post date:** [April 23, 2014, 1:59am UTC](https://forum.ansible.com/t/orchestration-between-os-provisioning-and-configuration-management-barrier-behavior-between-cobbler-and-ansible/15070/1 "2014-04-23T01:59:47Z")

</div>

I configure Cobblerd in a certain way to install OS onto my bare-metal machines. Say I configured 5 systems (therefore intend to install 5 machines).

Then I would like to configure the following inventory (suppose Cobbler configuration has taken care of the static IP address setup for the bare metal machine)

```auto
(/etc/ansible/hosts)

```

```auto
[webservers]
10.20.2.11
10.20.2.12

```

```auto
[dbservers]
10.20.2.13
10.20.2.14
10.20.2.15

```

I would like wait to run my playbook until the OS have been actually provisioned. Otherwise, my playbook will fail because the nodes won’t be read for ssh.

My question is whether there is a way to make a barrier between Cobbler installation finished and the Ansible cookbook start to launch. Is there a notification mechanism so that I can wait all 5 machines’ OS are ready?

Thanks,  
Sean

---

<div class="post-metadata">

**Author:** ![Tomasz\_Kontusz](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@Tomasz\_Kontusz](https://forum.ansible.com/u/Tomasz_Kontusz)\
**Post date:** [April 23, 2014, 6:36am UTC](https://forum.ansible.com/t/orchestration-between-os-provisioning-and-configuration-management-barrier-behavior-between-cobbler-and-ansible/15070/2 "2014-04-23T06:36:24Z")

</div>

Sean \<sean.bigdatafun@gmail.com\> napisał:

> My question is whether there is a way to make a barrier between Cobbler  
> installation finished and the Ansible cookbook start to launch. Is  
> there a  
> notification mechanism so that I can wait all 5 machines' OS are ready?

I don't know about cobbler, but you can wait for the machines with wait\_for module ([http://docs.ansible.com/wait\_for\_module.html](http://docs.ansible.com/wait_for_module.html)). Something like this at the beginning of your playbook will wait until all the hosts have port 22 open (but no longer than 900 seconds):

- hosts: all  
&nbsp;&nbsp;gather\_facts: no # makes sure Ansible won't attempt connection too soon  
&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;- local\_action: wait\_for host={{inventory\_hostname}} port=22 timeout=900

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 23, 2014, 1:33pm UTC](https://forum.ansible.com/t/orchestration-between-os-provisioning-and-configuration-management-barrier-behavior-between-cobbler-and-ansible/15070/3 "2014-04-23T13:33:46Z")

</div>

A few options that don’t involve ansible calling Cobbler:

(A) admit defeat and run it in two steps - base OS install, trigger ansible

(B) trigger ansible-pull at the end of the cobbler run in kickstart %post.

(C) trigger ansible at the end of the cobbler run in kickstart %post using provisioning callbacks in Tower. This doesn’t work 100% smoothly though because Tower doesn’t have a “automatically sync with cobbler” integration like it does with AWS and Rackspace. This will likely happen for arbitrary inventory scripts later.

Though having ansible call the cobbler edit command with --force is not a bad idea. It could set up DHCP/DNS with a simple edit command and then wait for connectivity.

You may also want to look into the “do/until” loop constructs if you’d like to also wait for another service to come online.

In the past, I’ve seen people try to synchronize a config tool list of info with cobbler, and that usually gets complicated. But if it’s just going to wrap “cobbler \_\_\_ edit” + a few commands, wait for SSH, and then do the rest that’s ok.

Ansible pull would be pretty simple though, provided you were ok with having some of the bootstrap stuff in an accessible git repo.

Alternatively you could also package the playbook in a tarball, etc, extract it in post, etc. ansible-pull is really just a proof of concept that is completely usable in the real world in many cases 🙂

---

<div class="post-metadata">

**Author:** ![Hrishikesh\_Trivedi](https://avatars.discourse-cdn.com/v4/letter/h/edb3f5/32.png) [@Hrishikesh\_Trivedi](https://forum.ansible.com/u/Hrishikesh_Trivedi)\
**Post date:** [April 15, 2015, 6:28am UTC](https://forum.ansible.com/t/orchestration-between-os-provisioning-and-configuration-management-barrier-behavior-between-cobbler-and-ansible/15070/4 "2015-04-15T06:28:47Z")

</div>

Hi,

I am also looking for a similar solution. I have cobbler server setup that takes care of OS + Network Config. My cobbler server is now also my ansible control machine. So I have Cobbler + Ansible on the same server.

From the 3 options mentioned by you, A is not a choice for me and C seems to be second choice for me. First choice would be (B) trigger ansible-pull at the end of the cobbler run in kickstart %post. Does this require ansible installation on the newly built node ? If not, can you please describe how should I achieve this ? If it requires ansible installation on the newly built instance, I have to work out something else.

Thanks in advance,  
Hrishikesh
