71 lines
2.3 KiB
YAML
71 lines
2.3 KiB
YAML
# vim: set filetype=yaml.ansible :
|
|
#
|
|
## Package: ansible_lint
|
|
## Description: Linter for ansible yaml
|
|
## Version: latest
|
|
## Methods: source
|
|
## Helpers: pipx
|
|
---
|
|
- name: Set ansible_lint default facts # {{{
|
|
ansible.builtin.set_fact:
|
|
ansible_lint:
|
|
methods:
|
|
default: [source]
|
|
Archlinux: [system, source]
|
|
pkgname:
|
|
default: ansible-lint
|
|
FreeBSD: py311-ansible-lint
|
|
|
|
- name: Finalise ansible_lint default facts
|
|
ansible.builtin.set_fact:
|
|
ansible_lint:
|
|
methods: "{{ ansible_lint.methods[os_family] | default(ansible_lint.methods.default) }}"
|
|
version: "{{ ansible_lint_version | default('latest') }}"
|
|
pkgname: "{{ ansible_lint.pkgname[os_family] | default(ansible_lint.pkgname.default) }}"
|
|
pip:
|
|
name: ansible_lint
|
|
pkg_deps:
|
|
- pipx
|
|
# }}}
|
|
- name: Configure ansible_lint
|
|
when:
|
|
- "'ansible_lint' not in __configured"
|
|
block:
|
|
- name: Set ansible_lint install method
|
|
when:
|
|
- ansible_lint_imethod is undefined
|
|
block:
|
|
- name: Set ansible_lint install method
|
|
when:
|
|
- ansible_lint_imethod is undefined
|
|
ansible.builtin.set_fact:
|
|
ansible_lint_imethod: "{{ imethod if imethod in ansible_lint.methods else ansible_lint.methods[0] }}"
|
|
|
|
- name: Configure pipx source install
|
|
when:
|
|
- ansible_lint_imethod == "source"
|
|
block:
|
|
- name: Add ansible_lint to pipx install list
|
|
ansible.builtin.set_fact:
|
|
pkg_pipx: "{{ pkg_pipx + [ansible_lint.pip.name }}"
|
|
ansible_lint_install: "{{ ansible_lint_imethod }}={{ ansible_lint.pip.name }}"
|
|
- name: Add ansible lint package deps
|
|
loop: "{{ ansible_lint.pkg_deps }}"
|
|
loop_control:
|
|
loop_var: dep
|
|
ansible.builtin.include_tasks: pkgs/{{ dep }}.yml
|
|
|
|
|
|
- name: Append ansible-lint to system install list
|
|
when:
|
|
- ansible_lint_imethod == 'system'
|
|
block:
|
|
- name: Queue ansible_lint system install
|
|
ansible.builtin.set_fact:
|
|
pkg_sys: "{{ pkg_sys + [ansible_lint.pkgname] }}"
|
|
ansible_lint_install: "{{ ansible_lint_imethod }}={{ ansible_lint.pkgname }}"
|
|
|
|
- name: Complete ansible_lint configuration
|
|
ansible.builtin.set_fact:
|
|
__configured: "{{ __configured | combine( { 'ansible_lint': ansible_lint_install } ) }}"
|