Hiera equivalent for Ansible

Hi All,

Is there a Hiera equivalent for Ansible? For example I want to build an array of packages to install for a host which is made up of packages in host_vars, group_vars and perhaps some common packages that apply to all. If Hiera doesn’t exist, how could something like this be achieved?

Thanks.
GS

No tool currently and I think setting up such things in ansible is simple
enough that no equivalent tool will be made.

Do you have an example?

look at roles, but you can also do this with play playbooks (i did before roles came)

base.yml

  • common_packages.yml
  • removes_cruft.yml
  • setup_admin_accounts.yml
  • remove_old_admins.yml

External inventory scripts, see docs.

Ansible has a much more flexible classifier and way easier to understand!

– Michael

You are wrong Brian, external inventory and group classification are already there, and also lookup plugins :slight_smile:

– Michael

Roles are useful but what is being asked about is how playbooks map hosts to roles using the “hosts:” directive.

– Michael

Ah, sorry, yes, i was assuming dynamic inventory (ass == me) and then just use plays/roles to organize based on that.

Thanks Michael/Brian. I’ll look into using an external inventory script.

Look into group_by if you wish to make dynamic groups based on variables too!

– Michael