I know that I am just missing something, but I think that I have been staring at this too long to figure out what I am missing. I have the following in my host vars file:
Ok, so how can I loop that, since each machine could have more than one cert? I thought that using certs as the subscript for the hostvars would make the myfishbowl.com the “item”.
You’ve got a weird mix of yaml and json going on there. I started to mention that at first but didn’t want to confuse the issue. Your certs is exactly the same as
which I find easier to read, but you do you.
So "{{ certs[0].keys() }}" will give the single-element list: ['myfishbowl.com']. Maybe that’s what you want, but since you’ve got the same value in common_name maybe not? Maybe you want this:
hostvars[inventory_hostname] is an anti-pattern; variables from the inventory host should be accessed directly, since that’s the default source of variables.