If you think of it as a JSON dictionary this might explain why you had to do 
that.

This format ...

auditd_pkg:
  CentOS: audit
  Rocky: audit
  Debian: auditd
  Ubuntu: auditd

... is effectively the same as ...

auditd_pkg: { "CentOS": "audit", "Rocky": "audit", "Debian": "auditd", 
"Ubuntu": "auditd" }

Just helping ..

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

On Mar 2, 2023, at 2:20 PM, Kathy L <lyonsf...@gmail.com> wrote:

That works,  thanks!

On Thursday, March 2, 2023 at 12:33:32 PM UTC-5 Rowe, Walter P. (Fed) wrote:
You need use the ansible_os_family fact as a key into your auditd_pkg 
dictionary.

{{ auditd_pkg[ansible_os_family] }}

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123<tel:(202)%20355-4123>

On Mar 2, 2023, at 11:57 AM, Kathy L <lyon...@gmail.com> wrote:

In our playbooks, we used to load one OS-specific vars file for all our roles. 
Now we'd like to move the variables into each role.  A method I had to do this 
before does not seem to be working.  For our auditd role, in the vars/main.yml 
file I have this:

auditd_pkg:
  CentOS: audit
  Rocky: audit
  Debian: auditd
  Ubuntu: auditd

But it gives me this error:

argument 'package' is of type <class dict> and we were unable to convert to 
list:

How else can I list these variables without having specific os-related files in 
each role?


--
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-proje...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c58a3df2-0639-47fd-85fd-801897604f4cn%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2Fc58a3df2-0639-47fd-85fd-801897604f4cn%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Ca00550f59d46449aa61008db1b533ed7%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638133816579724233%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1i5Nso7pJ%2FvLx2JbzDDPc2yqY8VLKD2LFE08zQ%2Fd0Yw%3D&reserved=0>.


--
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
ansible-project+unsubscr...@googlegroups.com<mailto:ansible-project+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2a11a576-bdfb-417c-b2b0-5cc437101b39n%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F2a11a576-bdfb-417c-b2b0-5cc437101b39n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Ca00550f59d46449aa61008db1b533ed7%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638133816579724233%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=wSbIK%2BeL9ig1yrLtO7HEcKSZFyq8OHnjlAIybwBLjzs%3D&reserved=0>.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6CCE27B2-E5BE-4655-87AB-2EF681D57873%40nist.gov.

Reply via email to