Using group_vars and host_vars with Ansible


Given that I don’t have the ability to enter complex data types for Ansible variables, I’d like to use group_vars and or host_cars. Is this possible? I tried a quick POC and it didn’t seem to work.

Expected outcome:

Variables are accessible in playbooks.

Foreman and Proxy versions:


Foreman and Proxy plugin versions:

foreman_ansible 2.2.9

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)


if you add host(group) parameters to your hosts, they will be available in playbook when applying roles as described in docs. Improvements in this area are on the roadmap, any thoughts on what might be useful or how the workflow should look like will be welcome.

1 Like

Thanks @Ondrej_Prazak! I’m currently using that feature for host_vars. For group_vars, I relocated the temporary inventory and playbook files to a predictable, non /tmp, location with a group_vars folder next to it so that it is found by Ansible automatically.

Ideally, it would be nice to have some kind of UI where I can:

  • perform CRUD operations for host_vars and group_vars
    e.g. create new hosts and new groups and add variables to them, etc.
  • put in any valid YAML values
    e.g. a list of hashes, multi-line strings (using “|”, “>”, etc.)
  • view what variables (both group and host) are being applied to a host

…those are the ones that come to mind atm.


are there already options for importing / including variables from a host_vars file and group_vars file?

I would like to have the configuration in my git repository, and not in db saved.