# Ansible ENC for The Foreman

**URL:** <https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270>\
**Category:** Ansible Project\
**Created:** [January 31, 2013, 4:07am UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270 "2013-01-31T04:07:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [January 31, 2013, 4:07am UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270/1 "2013-01-31T04:07:08Z")

</div>

I’ve created a new ENC for ansible that allows it to communicate and get node lists and node vars from The Foreman ([http://theforeman.org/](http://theforeman.org/)) and thought I’d share.

If you don’t know what The Foreman is you can probably disregard this email as Ansible can probably do all of what you need. But, if you’re like me and in an organization that has a lot of time and work-flows built around The Foreman and Puppet this ENC can use that existing data and makes it easy to classify and group your nodes based on any puppet fact.

[https://github.com/romeotheriault/foreman-ansible](https://github.com/romeotheriault/foreman-ansible)

Cheers,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 31, 2013, 5:06am UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270/2 "2013-01-31T05:06:45Z")

</div>

It would be interesting if you could get Foreman to support ansible facts.

Though that's ansible itself, and the group\_by module, so I guess you  
don't need it in that case, kind of 🙂

--Michael

---

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [January 31, 2013, 7:29pm UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270/3 "2013-01-31T19:29:01Z")

</div>

> It would be interesting if you could get Foreman to support ansible facts.

Hadn't thought much about that but yeah, I agree that would be  
interesting... It's probably not that far off either as there's been some  
talk on the foreman list about making it support other CM tools besides  
puppet, which would be ideal. I'll kick this idea around some more ...

> Though that's ansible itself, and the group\_by module, so I guess you  
> don't need it in that case, kind of 🙂

Kind of 🙂 group\_by module is great up to a certain node count, beyond  
which ssh'ing into each server and running the 'setup' module starts to  
take more time than one would like.

Romeo

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 31, 2013, 7:31pm UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270/4 "2013-01-31T19:31:52Z")

</div>

There are a couple of callback modules that keep an inventory DB with  
facts. If there is a scaling issue it should not be hard to make  
setup\_localstore? work.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 31, 2013, 7:33pm UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270/5 "2013-01-31T19:33:33Z")

</div>

> Kind of 🙂 group\_by module is great up to a certain node count, beyond which  
> ssh'ing into each server and running the 'setup' module starts to take more  
> time than one would like.

More reason to use fireball, no?. Only SSH to each server once.

See also:

gather\_facts: False on plays that don't need to gather facts.

---

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [January 31, 2013, 7:42pm UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270/6 "2013-01-31T19:42:54Z")

</div>

> There are a couple of callback modules that keep an inventory DB with  
> facts.

Good to know, I wasn't aware of these. I'll check them out. Though, we're  
not going to be moving away from puppet for "a while" so for my particular  
case it makes more sense to make use of our already available "facts"  
instead of duplicating them into another place.

> If there is a scaling issue it should not be hard to make  
> setup\_localstore? work.

I think that sounds like a great idea.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 31, 2013, 7:47pm UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270/7 "2013-01-31T19:47:49Z")

</div>

Actually, nix the setup\_xxx, I believe you can just use a inventory  
script to do the same.

---

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [January 31, 2013, 7:48pm UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270/8 "2013-01-31T19:48:41Z")

</div>

Agreed, in some cases that'd be a reasonable method. In my case we support  
a lot of legacy solaris systems where I'm not really interested in getting  
the fireball bits working on them and like I said we already have all the  
info we need available in a DB so figured we'd use it.

---

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [January 31, 2013, 7:50pm UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270/9 "2013-01-31T19:50:47Z")

</div>

Not sure I'm following you here.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [February 4, 2013, 5:08pm UTC](https://forum.ansible.com/t/ansible-enc-for-the-foreman/12270/10 "2013-02-04T17:08:24Z")

</div>

sorry for late reply, missed this.

Your inventory script can be an executable that returns hosts, groups  
and vars dynamically to ansible.
