tripleo-validations/validations/tasks/disk_space.yaml
Florian Fuchs c16a61649c Remove syntax warnings for when statements
Ansible>=2.3.0 will output warnings if `when` statements contain jinja2
templating delimiters such as curly braces (the playbooks are executing
fine, despite the warnings).

This patch changes these statements to use the correct syntax as
suggested in the docs.

Change-Id: I58657253bdc46e90eec6dea7ea5e07a2bf6c466e
Closes-Bug: #1721213
2017-10-04 13:16:48 +02:00

20 lines
1.0 KiB
YAML

- 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)
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 * 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 / 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 * const_bytes_in_gb|int >= item.size_available|int"