evolinux-base and admin-users are only compatible Debian >=8, declare once in main.yml and that's all

(will be probably generalized to others modules if needed)
This commit is contained in:
Gregory Colpart 2017-08-22 00:42:14 +02:00
parent 606f3a14f5
commit 5226082db0
6 changed files with 15 additions and 6 deletions

View file

@ -12,6 +12,7 @@ galaxy_info:
- name: Debian - name: Debian
versions: versions:
- jessie - jessie
- stretch
dependencies: [] dependencies: []
# List your role dependencies here, one per line. # List your role dependencies here, one per line.

View file

@ -1,5 +1,11 @@
--- ---
- fail:
msg: only compatible with Debian >= 8
when:
- ansible_distribution == "Debian"
- 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!"
when: admin_users == {} when: admin_users == {}

View file

@ -21,7 +21,6 @@
replace: '\1,{{ user.name }}' replace: '\1,{{ user.name }}'
validate: '/usr/sbin/visudo -cf %s' validate: '/usr/sbin/visudo -cf %s'
when: when:
- ansible_distribution == "Debian"
- ansible_distribution_release == "jessie" - ansible_distribution_release == "jessie"
- not copy_sudoers_evolinux.changed - not copy_sudoers_evolinux.changed

View file

@ -1,4 +1,11 @@
--- ---
- fail:
msg: only compatible with Debian >= 8
when:
- ansible_distribution == "Debian"
- ansible_distribution_major_version | version_compare('8', '<')
- name: Hostname - name: Hostname
include: hostname.yml include: hostname.yml
when: evolinux_hostname_include when: evolinux_hostname_include

View file

@ -79,7 +79,6 @@
- net-tools - net-tools
when: when:
- evolinux_packages_stretch - evolinux_packages_stretch
- ansible_distribution == "Debian"
- ansible_distribution_major_version | version_compare('9', '>=') - ansible_distribution_major_version | version_compare('9', '>=')
- name: Customize logcheck recipient - name: Customize logcheck recipient
@ -111,7 +110,6 @@
- { option: "which", value: "both" } - { option: "which", value: "both" }
when: when:
- evolinux_packages_listchanges - evolinux_packages_listchanges
- ansible_distribution == "Debian"
- ansible_distribution_release == "jessie" - ansible_distribution_release == "jessie"
- meta: flush_handlers - meta: flush_handlers

View file

@ -75,8 +75,6 @@
regexp: '^#?LogLevel [A-Z]+' regexp: '^#?LogLevel [A-Z]+'
replace: "LogLevel VERBOSE" replace: "LogLevel VERBOSE"
notify: reload sshd notify: reload sshd
when: when: ansible_distribution_major_version | version_compare('9', '>=')
- ansible_distribution == "Debian"
- ansible_distribution_major_version | version_compare('9', '>=')
- meta: flush_handlers - meta: flush_handlers