Merge "undercloud-disk-space.yaml: improved output"
This commit is contained in:
@@ -16,20 +16,22 @@
|
||||
- pre-introspection
|
||||
min_undercloud_disk_gb: 60
|
||||
tasks:
|
||||
- name: Set a constant defining number of Bytes in 1 GB
|
||||
set_fact:
|
||||
const_bytes_in_gb: 1073741824
|
||||
|
||||
- name: Verify disk space in /var (if it exists)
|
||||
# NOTE(shadower): 1073741824 == (1024 * 1024 * 1024), i.e. bytes
|
||||
# in a gigabyte
|
||||
fail: msg="The available space on the /var partition is {{ item.size_available|int / 1073741824 }} GB, but it should be at least {{ min_undercloud_disk_gb }} GB."
|
||||
fail: msg="The available space on the /var partition is {{ (item.size_available|int / const_bytes_in_gb|int)|round(1) }} GB, but it should be at least {{ min_undercloud_disk_gb }} GB."
|
||||
with_items: "{{ ansible_mounts }}"
|
||||
when: "'/var' == '{{ item.mount }}'"
|
||||
failed_when: "{{ min_undercloud_disk_gb|int * 1073741824 }} >= {{ item.size_available|int }}"
|
||||
failed_when: "{{ min_undercloud_disk_gb|int * const_bytes_in_gb|int }} >= {{ item.size_available|int }}"
|
||||
# Notify the next task that we've checked /var (and that it exists)
|
||||
changed_when: True
|
||||
register: previous
|
||||
|
||||
- name: Verify root disk space
|
||||
fail: msg="The available space on the root partition is {{ item.size_available|int / 1073741824 }} GB, but it should be at least {{ min_undercloud_disk_gb }} GB."
|
||||
fail: msg="The available space on the root partition is {{ (item.size_available|int / const_bytes_in_gb|int)|round(1) }} GB, but it should be at least {{ min_undercloud_disk_gb }} GB."
|
||||
with_items: "{{ ansible_mounts }}"
|
||||
# Only run this when /var doesn't exist
|
||||
when: "{{ not previous.changed }} and '/' == '{{ item.mount }}'"
|
||||
failed_when: "{{ min_undercloud_disk_gb|int * 1073741824 }} >= {{ item.size_available|int }}"
|
||||
failed_when: "{{ min_undercloud_disk_gb|int * const_bytes_in_gb|int }} >= {{ item.size_available|int }}"
|
||||
|
||||
Reference in New Issue
Block a user