Forgive me for combining questions, but I'm looking at two options for solving a problem and I'm not sure which one is best, or the exact syntax for either one.
First, I'm wondering if it's possible to set tags for resources create with hiera and create_resources. The first stab I took at syntax looked something like this:
-- hieradata/common.yaml
users:
myuser:
tag:
- admin
- backups
-- users/manifests/init.pp
$all_users = hiera_hash('users')
create_resources(@user, $all_users)
-- users/manifests/admin.pp
User <| tag == 'admin' |>
This is complicated a bit by bug #20972 and the fact that I'm actually using a custom defined type and a wrapper around it in place of @user, but the above should illustrate what I'm trying to do. Once I know if it's possible and how to make it happen, I can sort out the complications of a wrapper type around the final resource.
Failing that, I'm looking at passing a list of users to a resource collector like so:
-- hieradata/common.yaml
adminusers:
- bob
- joe
-- users/manifests/admin.pp
$admin_users = hiera_array('adminusers')
User <| title == $admin_users |>
I also tried 'title in $admin_users' but that didn't work either.
Is there a way to accomplish either of these approaches?