manage_pipx_packages/molecule/default/verify.yml

29 lines
951 B
YAML
Raw Normal View History

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"
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"
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"
ansible.builtin.assert:
that:
2023-08-24 21:23:51 +00:00
- pipx_simple_list['ansible-lint'] is defined
- name: "Print installed packages"
ansible.builtin.debug:
msg: "{{ pipx_simple_list }}"