Skip to content

Commit

Permalink
Update root disk space check, closes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
blues-man committed Oct 2, 2018
1 parent 0b6a479 commit c20c515
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions playbooks/roles/check_storage/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
- name: Set root disk facts
set_fact:
root_space_available_bytes: "{{ ( root_space_available.stdout | int) * 1024 | int }}"
- name: Set root disk in bytes
set_fact:
disk_free_space_bytes: "{{ ((disk_free_space | int) * 1024**3) | int }}"
- name: Set root disk size in GB
set_fact:
root_gb_available: "{{ ((root_space_available_bytes | int ) / 1024**3) | round(2, 'floor') }}"
- name: Fail if there is not enough space available in /
assert:
that: |
(root_space_available_bytes | int) >= (disk_free_space * 1000000000 | int)
msg: "There is no enough space available on this node"
(root_space_available_bytes | int) >= (disk_free_space_bytes | int)
msg: "There is no enough root space available on this node, required {{disk_free_space}} available {{root_gb_available}}"

0 comments on commit c20c515

Please sign in to comment.