8c6512107c
Newer ansbile-lint finds "when" or "become" statements that are at the end of blocks. Ordering these before the block seems like a very logical thing to do, as we read from top-to-bottom so it's good to see if the block will execute or not. This is a no-op, and just moves the places the newer linter found. Change-Id: If4d1dc4343ea2575c64510e1829c3fe02d6c273f
33 lines
998 B
YAML
33 lines
998 B
YAML
- name: Make sure the role is run on supported distro
|
|
fail:
|
|
msg: |
|
|
This role supports Fedora only,
|
|
Add your distro package to: {{ opendev_url }}/roles/ensure-shake/vars/
|
|
when: "ansible_distribution != 'Fedora'"
|
|
vars:
|
|
opendev_url: https://opendev.org/zuul/zuul-jobs/src/branch/master/
|
|
|
|
- name: Check shake version
|
|
command: shake --version
|
|
failed_when: false
|
|
register: _shake_version
|
|
|
|
- name: Install shake
|
|
when: "_shake_version.rc != 0"
|
|
block:
|
|
- name: Include OS-specific variables
|
|
include_vars: "{{ zj_distro_os }}"
|
|
loop_control:
|
|
loop_var: zj_distro_os
|
|
with_first_found:
|
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
|
- "{{ ansible_distribution }}.{{ ansible_architecture }}.yaml"
|
|
- "{{ ansible_distribution }}.yaml"
|
|
- "{{ ansible_os_family }}.yaml"
|
|
|
|
- name: Install shake
|
|
package:
|
|
name: "{{ shake_packages }}"
|
|
state: present
|
|
become: yes
|