The foreman ansible plugin questions

Hello.
I read the documenation to foreman ansible plugin and have some questions.

  1. Do I need ansible server to execute playbooks?
    Or It is enough to install foreman-ansible plugin.

We have ansible server running with a dynamic inventory script. In our dynamic inventory script we set ansibe_password and ansible_user (host_vars) dynamically.

  1. How can i use foreman to run playbooks and use my own dynamic inventory.

  2. Can i override all ansible variables through foreman (over the parameter tab on a spezific host)?

Foreman and Proxy versions:
Foreman 1.21 rc4

Foreman and Proxy plugin versions:
Foreman-ansible 2.3.1

Please help.
mobios

  1. Foreman runs ansible on the smart-proxy, so you could make your already existing server a smart-proxy with the ansible plugin installed. Foreman-ansible is the GUI part and required on Foreman.

  2. Using foreman-ansible to run playbooks will not use your dynamic inventory instead it uses its own dynamic inventory containing the hosts you selected for a job. Furthermore you will have to use roles instead of playbooks if you want to use the ansible integration more as configuration management than adhoc tasks because you import roles and assign them to hosts and not playbooks.

  3. Yes, the latest version of the plugin also gives you a better handling here so it is similar to smart variables in the Puppet integration and not only global parameters.

2 Likes

Thanks dirk for your help.

Let me clarify one point a bit more

You can use roles and playbooks. Roles can be assigned to host or host group, basically defining a configuration policy that should be enforced on the host. This is helpful if you try to mimic traditional cfgmgmt approach like with puppet/chef/salt.

But playbooks can be also imported as job templates and executed on any hosts regardless of any assignment. This is especially useful for one-time runs, such as deployment of some apps. Playbooks in Foreman can be even extended with ERB (ruby templating extension, similar to jinja), that gets evaluated just before the playbook is handed off to ansible-playbook. That allows further customization based on Foreman data and even building UI on top of playbooks through template inputs. There are some playbooks shipped by default, which can be used as a good example.