Improve distribution verification

This commit is contained in:
Gregory Colpart 2017-08-23 01:49:27 +02:00
parent a5db321717
commit 207a2f6011
6 changed files with 10 additions and 18 deletions

View file

@ -3,8 +3,7 @@
- fail: - fail:
msg: only compatible with Debian >= 8 msg: only compatible with Debian >= 8
when: when:
- ansible_distribution == "Debian" - ansible_distribution != "Debian" or ansible_distribution_major_version | version_compare('8', '<')
- ansible_distribution_major_version | version_compare('8', '<')
- debug: - debug:
msg: "Warning: empty 'admin_users' variable, tasks will be skipped!" msg: "Warning: empty 'admin_users' variable, tasks will be skipped!"

View file

@ -1,11 +1,9 @@
--- ---
- name: Fail if distribution is not supported - fail:
fail: msg: only compatible with Debian >= 8
msg: "Error: '{{ ansible_os_family }} {{ ansible_distribution_release }}' is not a supported distribution."
when: when:
- ansible_distribution_release != "jessie" - ansible_distribution != "Debian" or ansible_distribution_major_version | version_compare('8', '<')
- ansible_distribution_release != "stretch"
tags: tags:
- apt - apt

View file

@ -1,11 +1,9 @@
--- ---
- name: Fail if distribution is not supported - fail:
fail: msg: only compatible with Debian >= 8
msg: "Error: '{{ ansible_os_family }} {{ ansible_distribution_release }}' is not a supported distribution."
when: when:
- ansible_distribution_release != "jessie" - ansible_distribution != "Debian" or ansible_distribution_major_version | version_compare('8', '<')
- ansible_distribution_release != "stretch"
- include: certbot.yml - include: certbot.yml

View file

@ -3,8 +3,7 @@
- fail: - fail:
msg: only compatible with Debian >= 8 msg: only compatible with Debian >= 8
when: when:
- ansible_distribution == "Debian" - ansible_distribution != "Debian" or ansible_distribution_major_version | version_compare('8', '<')
- ansible_distribution_major_version | version_compare('8', '<')
- name: Hostname - name: Hostname
include: hostname.yml include: hostname.yml

View file

@ -3,8 +3,7 @@
- fail: - fail:
msg: only compatible with Debian >= 8 msg: only compatible with Debian >= 8
when: when:
- ansible_distribution == "Debian" - ansible_distribution != "Debian" or ansible_distribution_major_version | version_compare('8', '<')
- ansible_distribution_major_version | version_compare('8', '<')
- include: php_jessie.yml - include: php_jessie.yml
when: ansible_distribution_release == "jessie" when: ansible_distribution_release == "jessie"

View file

@ -3,8 +3,7 @@
- fail: - fail:
msg: only compatible with Debian >= 8 msg: only compatible with Debian >= 8
when: when:
- ansible_distribution == "Debian" - ansible_distribution != "Debian" or ansible_distribution_major_version | version_compare('8', '<')
- ansible_distribution_major_version | version_compare('8', '<')
- name: "Set squid name (jessie)" - name: "Set squid name (jessie)"
set_fact: set_fact: