55 lines
1.4 KiB
YAML
55 lines
1.4 KiB
YAML
- name: Test Ansible Lint Formatting via VirtualEnv
|
|
hosts: all
|
|
become: true
|
|
gather_facts: true
|
|
|
|
|
|
vars:
|
|
ansible_lint_venv_dir: /tmp/ansible-lint-venv
|
|
|
|
|
|
tasks:
|
|
- name: Enable CRB repository for python3-wheel
|
|
ansible.builtin.command:
|
|
cmd: dnf config-manager --enable crb
|
|
changed_when: true
|
|
|
|
|
|
- name: Ensure virtualenv command is present
|
|
ansible.builtin.package:
|
|
name:
|
|
- python3-setuptools
|
|
- virtualenv
|
|
state: present
|
|
|
|
|
|
- name: Create VirtualEnv and Install ansible-lint
|
|
ansible.builtin.pip:
|
|
name: ansible-lint==6.22.0
|
|
virtualenv: "{{ ansible_lint_venv_dir }}"
|
|
virtualenv_python: python3.9
|
|
|
|
|
|
# - name: Source venv
|
|
# ansible.builtin.shell:
|
|
# cmd: "source {{ ansible_lint_venv_dir }}/bin/activate"
|
|
# changed_when: false
|
|
|
|
|
|
- name: Test Ansible Lint - Version
|
|
ansible.builtin.command: "{{ ansible_lint_venv_dir }}/bin/ansible-lint --nocolor --version"
|
|
register: r_lint_version
|
|
changed_when: false
|
|
|
|
|
|
- name: Test Ansible Lint - Help
|
|
ansible.builtin.command: "{{ ansible_lint_venv_dir }}/bin/ansible-lint --nocolor --help"
|
|
register: r_lint_help
|
|
changed_when: false
|
|
|
|
|
|
- name: Show ansible-lint infos
|
|
ansible.builtin.debug:
|
|
msg: "ansible-lint version: {{ r_lint_version['stdout'] }}"
|
|
verbosity: 1
|