2023-11-29 21:22:59 +00:00
|
|
|
---
|
|
|
|
- name: Verify
|
|
|
|
hosts: all
|
|
|
|
gather_facts: true
|
2023-12-03 16:52:13 +00:00
|
|
|
become: true
|
2023-11-29 21:22:59 +00:00
|
|
|
tasks:
|
|
|
|
- name: "Test: packages pip, vault-cli, yamllint, ansible-core"
|
|
|
|
block:
|
|
|
|
- name: "Get pipx installed packages"
|
|
|
|
ansible.builtin.command: "pipx list --json"
|
|
|
|
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 }}"
|
|
|
|
|
|
|
|
- name: "Verify packages pip, vault-cli, yamllint, ansible-core"
|
|
|
|
ansible.builtin.assert:
|
|
|
|
that:
|
|
|
|
- pipx_simple_list['yamllint'] is defined
|
|
|
|
- pipx_simple_list['ansible-core'] is defined
|
|
|
|
- pipx_simple_list['vault-cli'] is defined
|
|
|
|
|
|
|
|
- name: "Print installed packages"
|
|
|
|
ansible.builtin.debug:
|
|
|
|
msg: "{{ pipx_simple_list }}"
|