Hi,
I’m kind of new to Ansible and I haven’t really gotten the terminology down yet, so I hope you’d bear with me.
I’ve got a task which loops through a bunch of disks and performs a set of operations on them. The placeholders/keys (CRS,DATA,FRA) are names on a sort of logical volumes which should use the disks listed under them.
The construct is loaded via group_vars or host_vars and looks like this:
It seems like you’re going to need another type of iterator (lookup plugin) that doesn’t exist to traverse these, akin to something like a with_dict_items or something.
I don’t know your use cases, but another option might be to just make the “data” and “fra” stuff a element inside the hash.
- name: Blerg
shell: "Use {{ item.disk }} and set label={{ item.label }} "
with_items: storage_config
when: item.category in [ ‘fra’, ‘crs’, ‘data’ ]
etc?
Ok, at least I know then. I’ll try your suggestions and see where it takes me.
As for the use case, this will be part of an Oracle DBaaS-offering where we’re going to use Ansible to deploy everything (Provision VM’s, os/storage-config, Oracle Real Application clusters etc) and this is one part of the storage-config.
The names (crs,data,fra) are just arbitrary names for Storage volume groups. There could be more of them and they could (potentially) be named differently. If we limit the possibility to set names on the volumegroups, I guess I could have different tasks/plays depending on the input…
I’ll try some things out and let you know.
Thanks!
/P