2023-08-22 21:19:33 +00:00
|
|
|
---
|
|
|
|
- name: Verify
|
|
|
|
hosts: all
|
2023-12-03 16:52:13 +00:00
|
|
|
gather_facts: true
|
|
|
|
become: true
|
2023-08-22 21:19:33 +00:00
|
|
|
tasks:
|
2023-08-24 21:23:51 +00:00
|
|
|
- name: "Test: packages ansible-lint"
|
2023-08-24 19:55:43 +00:00
|
|
|
block:
|
|
|
|
- name: "Get pipx installed packages"
|
|
|
|
ansible.builtin.command: "pipx list --json"
|
2023-08-24 21:23:51 +00:00
|
|
|
environment:
|
|
|
|
PIPX_HOME: "/opt/pipx"
|
2023-08-24 19:55:43 +00:00
|
|
|
changed_when: false
|
|
|
|
register: pipx_installed_packages
|
|
|
|
|
|
|
|
- name: "Set fact"
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
pipx_simple_list: "{{ pipx_simple_list | default({}) | combine({item.key: item.value.metadata.main_package.package_version}) }}"
|
|
|
|
loop: "{{ pipx_installed_packages.stdout | from_json | json_query('venvs') | dict2items }}"
|
|
|
|
|
2023-08-24 21:23:51 +00:00
|
|
|
- name: "Verify packages ansible-lint"
|
2023-08-24 19:55:43 +00:00
|
|
|
ansible.builtin.assert:
|
|
|
|
that:
|
2023-08-24 21:23:51 +00:00
|
|
|
- pipx_simple_list['ansible-lint'] is defined
|
2023-08-24 19:55:43 +00:00
|
|
|
|
|
|
|
- name: "Print installed packages"
|
|
|
|
ansible.builtin.debug:
|
|
|
|
msg: "{{ pipx_simple_list }}"
|