-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from adfinis/feat/playbooks/calculate_quota
feat(playbooks): playbook to calculate Bareos Pool quota
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
|
||
- name: Loop over all pools and calculate maximum disk quota | ||
hosts: localhost | ||
become: false | ||
gather_facts: false | ||
check_mode: true | ||
tasks: | ||
- name: Make sure necessary Pool values are set | ||
ansible.builtin.assert: | ||
quiet: true | ||
that: | ||
- item is defined | ||
- item is iterable | ||
- item.maximum_volume_bytes is defined | ||
- item.maximum_volumes is defined | ||
success_msg: Necessary variables are set. | ||
fail_msg: >- | ||
It looks like no limits are defined for the pool {{ item.name}}! | ||
Make sure maximum_volume_bytes and maximum_volumes are set. | ||
loop: "{{ bareos_dir_pools }}" | ||
|
||
- name: Loop over pools to calculta quota | ||
ansible.builtin.set_fact: | ||
_quota: "{{ _quota | default(0) | int + item.maximum_volume_bytes | int * item.maximum_volumes | int }}" | ||
loop: "{{ bareos_dir_pools }}" | ||
|
||
- name: Print total customer quota | ||
ansible.builtin.debug: | ||
msg: >- | ||
Total Pool quota is {{ ( _quota | int / 1024 / 1024 / 1024 ) | int }} GB. |