---
- hosts: undercloud
  vars:
    metadata:
      name: Verify the undercloud fits the RAM requirements
      description: >
        Verify that the undercloud has enough RAM.

        https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/sect-Undercloud_Requirements.html
      groups:
        - prep
        - pre-introspection
    min_undercloud_ram_gb: 16
  tasks:
  - name: Verify the RAM requirements
    fail: msg="The RAM on the undercloud node is {{ ansible_memtotal_mb }} MB, the minimal recommended value is {{ min_undercloud_ram_gb|int * 1024 }} MB."
    # NOTE(shadower): converting GB to MB
    failed_when: "({{ ansible_memtotal_mb }}) < {{ min_undercloud_ram_gb|int * 1024 }}"
