---
# File: asserts.yml - Asserts for this playbook

- name: Check distribution compatibility
  fail:
    msg: "{{ ansible_distribution }} is not supported by this role"
  when: ansible_distribution not in ['RedHat', 'CentOS', 'Debian', 'Ubuntu']

- name: Fail if not a new release of Red Hat / CentOS
  fail:
    msg: "{{ ansible_distribution_version }} is not a supported version of {{ ansible_distribution }} for this role"
  when: ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_version is version_compare(6, '<')

- name: Fail if not a new release of Debian
  fail:
    msg: "{{ ansible_distribution_version }} is not a supported version of {{ ansible_distribution }} for this role"
  when: ansible_distribution == "Debian" and ansible_distribution_version is version_compare(8.2, '<')

- name: Fail if not a new release of Ubuntu
  fail:
    msg: "{{ ansible_distribution_version }} is not a supported version of {{ ansible_distribution }} for this role"
  when: ansible_distribution == "Ubuntu" and ansible_distribution_version is version_compare(13.04, '<')

---
# File: asserts.yml - Asserts for this playbook

- name: Check distribution compatibility
  fail:
    msg: "{{ ansible_distribution }} is not supported by this role"
  when: ansible_distribution not in ['RedHat', 'CentOS', 'Debian', 'Ubuntu']

- name: Fail if not a new release of Red Hat / CentOS
  fail:
    msg: "{{ ansible_distribution_version }} is not a supported version of {{ ansible_distribution }} for this role"
  when: ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_version is version_compare(6, '<')

- name: Fail if not a new release of Debian
  fail:
    msg: "{{ ansible_distribution_version }} is not a supported version of {{ ansible_distribution }} for this role"
  when: ansible_distribution == "Debian" and ansible_distribution_version is version_compare(8.2, '<')

- name: Fail if not a new release of Ubuntu
  fail:
    msg: "{{ ansible_distribution_version }} is not a supported version of {{ ansible_distribution }} for this role"
  when: ansible_distribution == "Ubuntu" and ansible_distribution_version is version_compare(13.04, '<')

- name: Check nomad_group_name is included in groups
  fail:
    msg: "nomad_group_name must be included in groups."
  when: nomad_group_name not in groups

Add check for presence of nomad_group_name groups
Add check for presence of nomad_group_name groups

Repurposed from the `brianshumate/ansible-consul` repo. The `Client configuration` task fails without this group present. This will remind people to provide it.
