Skip to content

Conversation

priteau
Copy link
Member

@priteau priteau commented Apr 1, 2025

This enables defining extra packages and users based on some conditions. For example:

appliances_extra_packages_other:
  - "{{ 'cuda-toolkit' if 'cuda' in group_names }}"

@priteau priteau self-assigned this Apr 1, 2025
@priteau priteau requested a review from a team as a code owner April 1, 2025 11:34
This enables defining extra packages and users based on some conditions,
for example:

    appliances_extra_packages_other:
      - "{{ 'cuda-toolkit' if 'cuda' in group_names }}"
@sjpb
Copy link
Collaborator

sjpb commented Apr 25, 2025

Normally we'd just do this via some indirection:

appliances_extra_packages_cuda:
  - 'cuda-toolkit'
appliances_extra_packages_other: "{{ if appliances_extra_packages_cuda 'cuda' in group_names else [] }}"

but seems fine.

Copy link
Collaborator

@sjpb sjpb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested logic locally and the select | list is enough to ditch the empty string you get.

@priteau
Copy link
Member Author

priteau commented Apr 25, 2025

Normally we'd just do this via some indirection:

appliances_extra_packages_cuda:
  - 'cuda-toolkit'
appliances_extra_packages_other: "{{ if appliances_extra_packages_cuda 'cuda' in group_names else [] }}"

but seems fine.

It is feasible with other methods, but with this approach we don't need to define additional variables.

@priteau priteau merged commit 4ef0c82 into main Apr 25, 2025
2 checks passed
@priteau priteau deleted the extra-list branch April 25, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants