59 lines
1.9 KiB
YAML
59 lines
1.9 KiB
YAML
# vim: set filetype=yaml.ansible :
|
|
---
|
|
- name: Configure ansible-lint
|
|
when:
|
|
- __ansible_lint_configured is undefined or
|
|
not __ansible_lint_configured
|
|
block:
|
|
- name: Set basic variables
|
|
ansible.builtin.set_fact:
|
|
ansible_lint_version: latest
|
|
|
|
- name: Configure package options
|
|
ansible.builtin.set_fact:
|
|
ansible_lint_install_method: "{{ ansible_lint_install_method | default(install_method) }}"
|
|
|
|
- name: Set pipx name
|
|
when:
|
|
- ansible_lint_install_method == 'pipx'
|
|
ansible.builtin.set_fact:
|
|
ansible_lint_pkgname: "{{ 'ansible_lint' if ansible_lint_version == 'latest' else 'ansible-lint==' ~ ansible_lint_version }}"
|
|
|
|
- name: Set package name
|
|
when:
|
|
- install_method == 'system'
|
|
block:
|
|
- name: Set package name RedHat/Debian/Alpine/Arch distros
|
|
when:
|
|
- ansible_os_family in ['RedHat', 'Debian', 'Alpine', 'Archlinux']
|
|
ansible.builtin.set_fact:
|
|
ansible_lint_pkgname: ansible-lint
|
|
|
|
- name: Set package name for FreeBSD
|
|
when:
|
|
- ansible_os_family == 'FreeBSD'
|
|
ansible.builtin.set_fact:
|
|
ansible_lint_pkgname: py311-ansible-lint
|
|
|
|
- name: Ensure ansible_lint_install_method is valid
|
|
when:
|
|
- ansible_lint_install_method not in ansible_lint_install_methods
|
|
ansible.builtin.set_fact:
|
|
ansible_lint_install_method: ansible_lint_install_methods[0]
|
|
|
|
- name: Complete ansible_lint configuration
|
|
ansible.builtin.set_fact:
|
|
__ansible_lint_configured: true
|
|
|
|
- name: Add ansible-lint to pipx install list
|
|
when:
|
|
- ansible_lint_install_method == 'pipx'
|
|
ansible.builtin.set_fact:
|
|
pkg_pipx: "{{ pkg_pipx + [ansible_lint_pkgname] }}"
|
|
|
|
- name: Append ansible-lint to system install list
|
|
when:
|
|
- ansible_lint_install_method == 'system'
|
|
ansible.builtin.set_fact:
|
|
pkg_sys: "{{ pkg_sys + [ansible_lint_pkgname] }}"
|