openafs_contrib / openafs_contrib.openafs / 1.9.0 / lookup / counter Increment named integer counters. Authors: Michael Meffieopenafs_contrib.openafs.counter (1.9.0) — lookup
Install with ansible-galaxy collection install openafs_contrib.openafs:==1.9.0
collections: - name: openafs_contrib.openafs version: 1.9.0
Counter values are saved in a json file on the controller. The default location of the counter file is C(~/.ansible/counter.json) Set the C(ANSIBLE_OPENAFS_COUNTER_DIR) environment variable to specify an alternate location.
By default, the the M(counter) lookup plugin increments then returns the incremented counter value.
Specify the C(,current) suffix on the counter name to retrieve the current counter value without incrementing the counter.
Specify the C(,reset) suffix on the counter name to reset the counter value to zero.
File locking used for mutual exclusion in case more than one playbook is running at a time.
- name: "Lookup the current value of test_a." debug: msg: "{{ lookup('openafs_contrib.openafs.counter', 'test_a,current') }}"
- name: "Increment counter test_a." debug: msg: "{{ lookup('openafs_contrib.openafs.counter', 'test_a') }}"
- name: "Increment counters using 'with_' syntax." debug: var: item with_openafs_contrib.openafs.counter: - test_a - test_b - test_c
- name: "Reset counters using 'with_' syntax." assert: that: item == 0 with_openafs_contrib.openafs.counter: - test_a,reset - test_b,reset - test_c,reset
_terms: description: - list of counter names, in the form I(<name>[,<operation>]), where I(<name>) is the counter name and I(<operation>) is one of C(next), C(current), C(reset) - The default operation is C(next) required: true
_list: description: List of counter values. elements: int type: list