Foreman-yml and Foreman Ansible playbook

Hi there!

Over the past few months we've worked with Foreman in several different
projects and we'd like to share two of these projects, which might be useful to
you. :slight_smile:

foreman-yml [1]

··· =============== Foreman-yml is a command line tool written in Python, which provides the ability to define the whole Foreman configuration (OS, partitioning templates, provisioning templates, etc.) in a simple and readable YAML file. In comparison to the hammer-cli foreman-yml is able to resolve the object names to its corresponding IDs. Meaning for example you can use the template names when defining the operating system without having to worry about the IDs. This also includes linking the corresponding objects, e.g. "check" the needed partiton templates in the OS context.

Foreman Ansible playbook [2]

In addition we’ve created a Foreman Ansible playbook from scratch, which
currently offers the following features:

  • setup database (SQLite or MySQL)
  • setup webserver (plain nginx as a proxy or nginx-passenger)
  • setup isc-dhcp-server
  • setup TFTP server
  • setup foreman-proxy
  • setup Foreman including configuration (templates, hosts, domains, etc.)

The playbook shouldn’t replace the foreman-installer but rather provide an
alternative way to setup Foreman instances for Ansible-oriented environments,
which often do not include any Puppet servers at all.

Currently it doesn’t cover all the possible features of the foreman-installer
but on the other hand allows one to fully configure Foreman thanks to the
integrated foreman-yml tool.

We made sure the playbook runs on many different distributions:

  • Debian 7 & 8
  • Ubuntu 14.04 & 16.04
  • CentOS 6 & 7
  • Red Hat Enterprise Linux 6 & 7

For us this provides a nice and even more important reproducable way to deploy
hands-free installations of Foreman.

Both tools are freely available under the GPLv3 license and are hosted on
GitHub.

We hope some of you can make use of them and would love to hear your feedback.
Contributions are more than welcome! :slight_smile:

[1] https://github.com/adfinis-sygroup/foreman-yml
[2] https://github.com/adfinis-sygroup/foreman-ansible

Cheers

Michael


Adfinis SyGroup AG
Michael Hofer, System Engineer

Keltenstrasse 98 | CH-3018 Bern
Tel. +41 31 550 31 11

> Hi there!
>
> Over the past few months we've worked with Foreman in several different
> projects and we'd like to share two of these projects, which might be useful to
> you. :slight_smile:
>
> foreman-yml [1]
> ===============
> Foreman-yml is a command line tool written in Python, which provides the
> ability to define the whole Foreman configuration (OS, partitioning
> templates, provisioning templates, etc.) in a simple and readable YAML file.
> In comparison to the hammer-cli foreman-yml is able to resolve the object names
> to its corresponding IDs. Meaning for example you can use the template names
> when defining the operating system without having to worry about the IDs. This
> also includes linking the corresponding objects, e.g. "check" the needed
> partiton templates in the OS context.
>
> Foreman Ansible playbook [2]
> ============================
> In addition we've created a Foreman Ansible playbook from scratch, which
> currently offers the following features:
>
> * setup database (SQLite or MySQL)
> * setup webserver (plain nginx as a proxy or nginx-passenger)
> * setup isc-dhcp-server
> * setup TFTP server
> * setup foreman-proxy
> * setup Foreman including configuration (templates, hosts, domains, etc.)
>
> The playbook shouldn't replace the foreman-installer but rather provide an
> alternative way to setup Foreman instances for Ansible-oriented environments,
> which often do not include any Puppet servers at all.
>
> Currently it doesn't cover all the possible features of the foreman-installer
> but on the other hand allows one to fully configure Foreman thanks to the
> integrated foreman-yml tool.
>
> We made sure the playbook runs on many different distributions:
>
> * Debian 7 & 8
> * Ubuntu 14.04 & 16.04
> * CentOS 6 & 7
> * Red Hat Enterprise Linux 6 & 7
>
> For us this provides a nice and even more important reproducable way to deploy
> hands-free installations of Foreman.
>
> Both tools are freely available under the GPLv3 license and are hosted on
> GitHub.

Neat, thanks! I can see how foreman-yml is useful (we had
https://github.com/Katello/hammer-cli-csv which did a similar thing via
hammer).

About the Ansible playbook - the installer doesn't necessarily install
Puppet in for anything other than the installation itself, but I can see
it's value, plus it's easier to understand for Ansible users I suppose.
Good work! I hope you find https://github.com/theforeman/foreman_ansible
and https://github.com/theforeman/foreman_ansible_inventory useful if
you're in such an environment.

Feel free to edit the wiki and add these two projects :slight_smile: -
http://projects.theforeman.org/projects/foreman/wiki/List_of_Plugins

··· On 08/10, Michael Hofer wrote:

We hope some of you can make use of them and would love to hear your feedback.
Contributions are more than welcome! :slight_smile:

[1] https://github.com/adfinis-sygroup/foreman-yml
[2] https://github.com/adfinis-sygroup/foreman-ansible

Cheers

Michael


Adfinis SyGroup AG
Michael Hofer, System Engineer

Keltenstrasse 98 | CH-3018 Bern
Tel. +41 31 550 31 11


You received this message because you are subscribed to the Google Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


Daniel Lobato Garcia

@dLobatog
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato

Sorry to revive an old thread, see for reasons below.
> foreman-yml [1]
> ===============
> Foreman-yml is a command line tool written in Python, which provides the
> ability to define the whole Foreman configuration (OS, partitioning
> templates, provisioning templates, etc.) in a simple and readable YAML file.
> In comparison to the hammer-cli foreman-yml is able to resolve the object names
> to its corresponding IDs. Meaning for example you can use the template names
> when defining the operating system without having to worry about the IDs. This
> also includes linking the corresponding objects, e.g. "check" the needed
> partiton templates in the OS context.
I'm trying to move a lot of info from my 1.11 to 1.12 and later 1.13 and
thought I could try this out.

I'm trying this on a Centos-7, foreman-1.12.2 instance but I get the
dreaded ERROR cannot connect to Foreman-API.
Looking at production.log I see the calls to get the version number and
then the call to apidoc/v2.json with a HTTP status code of 200 so OK.
After that I get the error so the message is not what is really
happening. Trying a few things I noticed that ipdb and single stepping
through I saw a syntax error pass by but can't pinpoint where that is
coming from other then that is after the apidoc/v2.json call. Thats
about as much python experience I can throw at it

Any help is appreciated,

Joop

Hey

[…]llo/hammer-cli-csv
> Neat, thanks! I can see how foreman-yml is useful (we had
> https://github.com/Katello/hammer-cli-csv which did a similar thing via
> hammer).

Thanks for the feedback, really appreciated!

Oh, I should checkout the Katello namespace more often to not miss out some of
the tools. :wink:

By the way, foreman-yml also supports dumping the config into a YAML file, the
README update is currently pending.

> About the Ansible playbook - the installer doesn't necessarily install
> Puppet in for anything other than the installation itself, but I can see
> it's value, plus it's easier to understand for Ansible users I suppose.
> Good work! I hope you find https://github.com/theforeman/foreman_ansible
> and https://github.com/theforeman/foreman_ansible_inventory useful if
> you're in such an environment.

Thanks by the way for the new features in the foreman-ansible plugin. It's
great!

> Feel free to edit the wiki and add these two projects :slight_smile: -
> List of Plugins - Foreman
[…]

Done, I've added it to the very bottom.

Would foreman-yml or the Ansible playbook also be interesting for the
foreman-dev list? We didn't send it there to prevent crossposting.

Kind regards

Michael

··· On Thu, 11 Aug 2016 13:15:33 +0200 Daniel Lobato Garcia wrote:


Adfinis SyGroup AG
Michael Hofer, System Engineer

Keltenstrasse 98 | CH-3018 Bern
Tel. +41 31 550 31 11

Hi Joop

[…]
> I'm trying this on a Centos-7, foreman-1.12.2 instance but I get the
> dreaded ERROR cannot connect to Foreman-API.
> Looking at production.log I see the calls to get the version number and
> then the call to apidoc/v2.json with a HTTP status code of 200 so OK.
> After that I get the error so the message is not what is really
> happening. Trying a few things I noticed that ipdb and single stepping
> through I saw a syntax error pass by but can't pinpoint where that is
> coming from other then that is after the apidoc/v2.json call. Thats
> about as much python experience I can throw at it
[…]

Can you generate the apipie cache and please try again?

/usr/sbin/foreman-rake apipie:cache

Cheers

Michael

··· On Sat, 17 Sep 2016 13:16:01 +0200 jvandewege wrote: