Validation to verify undercloud disk size reqs

Change-Id: If717f388d9c761bc40d95d899c01a526e1b2d828
This commit is contained in:
Tomas Sedovic 2016-08-04 16:38:04 +02:00
parent 7456102348
commit 236ce74c37
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
---
- hosts: undercloud
vars:
metadata:
name: Verify undercloud fits the disk space requirements
description: >
Make sure that the root partition on the undercloud node is large enough.
We first check for an explicit `/var` mount point since that's
where we store logs and images and if it doesn't exist, we
fall back to `/`.
http://tripleo.org/environments/environments.html#id5
groups:
- prep
- pre-introspection
min_undercloud_disk_gb: 60
tasks:
- 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."
with_items: "{{ ansible_mounts }}"
when: "'/var' == '{{ item.mount }}'"
failed_when: "{{ min_undercloud_disk_gb|int * 1073741824 }} >= {{ 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."
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 }}"