community / community.general / 6.6.8 / filter / counter Counts hashable elements in a sequence | "added in version" 4.3.0 of community.general" Authors: Rémy Keil (@keilr)community.general.counter (6.6.8) — filter
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
Counts hashable elements in a sequence.
- name: Count occurrences ansible.builtin.debug: msg: >- {{ [1, 'a', 2, 2, 'a', 'b', 'a'] | community.general.counter }}
_input: description: A sequence. elements: any required: true type: list
_value: description: A dictionary with the elements of the sequence as keys, and their number of occurrences in the sequence as values. type: dictionary