I am looking for a solution to handle something like this:
roles:
- role1
- role2
configuration:
role:
role1:
-
domain: “*”
limit_type: hard
limit_item: nproc
value: 40960 -
domain: “*”
limit_type: soft
limit_item: nproc
value: 40960 -
name: setup role-specific limits
pam_limits:
dest: /etc/security/limits.d/user.conf
domain: “{{ pam_limits[‘role’][item][‘domain’] }}”
limit_type: “{{ pam_limits[‘role’][item][‘limit_type’] }}”
limit_item: “{{ pam_limits[‘role’][item][‘limit_item’] }}”
value: “{{ pam_limits[‘role’][item][‘value’] }}”
when: (‘role’ in pam_limits) and (item in pam_limits[‘role’])
with_items: “{{ roles }}”
I see an error: The task includes an option with an undefined variable. The error was: ‘list object’ has no attribute ‘domain’. Looks like pam_limits[‘role’][item] is the list and needs to be flattened.
Thank you.