Maybe the question I should be asking is how do people manage what packages get installed on what computers?
My approach might be wrong? I'm trying to figure out how to use group_vars for chocolatey packages to install when the managed host is in multiple groups. I'd like to append package named, identified by the managed host's group membership, to the group_var "chocolatey_packages" and use 1 task to install all the packages. The 1 ansible tasks: - name: Install programs (choco) win_chocolatey: name: "{{ item }}" state: "present" when: - chocolatey_packages is defined with_items: - "{{ chocolatey_packages }}" Here is the tree of how I have group_vars and the associated package names for that group CORP/ ├── company-wide-package1 ├── company-wide-package2 ├── company-wide-package3 ├── company-wide-package4 ├── company-wide-package5 └── sales ├── all-sales-people-package1 ├── all-sales-people-package2 ├── all-sales-people-package3 ├── inside │ └── all-inside-sales-people-package1 └── outside └── all-outside-sales-people-package1 Every computer is part of the CORP group. Some computers are part of the Sales group. Even less computers are part of the inside or outside sales group. All computers get the "company-wide" packages installed. All sales computers get the "all-sales-people" packages installed. All inside sales people get the "all-inside-sales-people" packages installed. All outside sales people get the "all-outside-sales-people" packages installed. I've tried to append list of packages to the chocolatey_packages variable but that seems fragile and tightly coupled to my group_vars layout. Variable definition inside CORP/win_chocolatey.yml chocolatey_corp_pkgs: - cleanup - firefox - git - googlechrome - veeam-agent - virtualclonedrive - winscp chocolatey_packages: "{{ chocolatey_corp_pkgs }}" Variable definition inside sales/win_chocolatey.yml chocolatey_sales_pkgs: - crystalreports2010runtime chocolatey_packages: "{{ chocolatey_corp_pkgs + chocolatey_sales_pkgs }}" Variable definitions inside the sales/inside/win_chocolatey.yml chocolatey_inside_sales_pkgs: - winscp chocolatey_packages: "{{ chocolatey_corp_pkgs + chocolatey_sales_pkgs + chocolatey_inside_sales_pkgs }}" And things do not work properly if a computer is part of the inside and outside sales groups (yes, there's 2 computers). -- 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 post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/130317c6-cb9f-40e2-8222-e3d5448f6503%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.