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.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/85c99e43-2325-4315-b884-f47d4b393819n%40googlegroups.com.

Reply via email to