Bertrand Lanson
879f0f11fe
All checks were successful
test / Linting (push) Successful in 41s
test / Molecule tests (default, ubuntu2004) (push) Successful in 1m9s
test / Molecule tests (default, debian11) (push) Successful in 1m32s
test / Molecule tests (default, debian12) (push) Successful in 1m27s
test / Molecule tests (with_custom_packages, debian11) (push) Successful in 48s
test / Molecule tests (default, ubuntu2204) (push) Successful in 1m2s
test / Molecule tests (with_custom_packages, debian12) (push) Successful in 54s
test / Molecule tests (with_custom_packages, ubuntu2204) (push) Successful in 54s
test / Molecule tests (with_custom_packages, ubuntu2004) (push) Successful in 1m11s
41 lines
1.6 KiB
YAML
41 lines
1.6 KiB
YAML
---
|
|
- name: Verify
|
|
hosts: all
|
|
gather_facts: true
|
|
become: true
|
|
tasks:
|
|
- name: "Test: packages pip, vault-cli, yamllint, docker"
|
|
vars:
|
|
wanted_up_to_date_list: ["pip", "docker"]
|
|
wanted_out_of_date_list: ["vault-cli", "yamllint"]
|
|
block:
|
|
- name: "Get pip3 up-to-date packages"
|
|
ansible.builtin.command: "pip3 list -u --format=json"
|
|
changed_when: false
|
|
register: pip_updated_packages
|
|
|
|
- name: "Get pip3 out-of-date packages"
|
|
ansible.builtin.command: "pip3 list -o --format=json"
|
|
changed_when: false
|
|
register: pip_outdated_packages
|
|
|
|
- name: "Set fact for pip3 up-to-date packages"
|
|
ansible.builtin.set_fact:
|
|
pip3_updated_list: "{{ pip3_updated_list | default({}) | combine({item.name: item.version}) }}"
|
|
loop: "{{ pip_updated_packages.stdout | from_json | selectattr('name', 'in', wanted_up_to_date_list) | list }}"
|
|
|
|
- name: "Set fact for pip3 out-of-date packages"
|
|
ansible.builtin.set_fact:
|
|
pip3_outdated_list: "{{ pip3_outdated_list | default({}) | combine({item.name: item.version}) }}"
|
|
loop: "{{ pip_outdated_packages.stdout | from_json | selectattr('name', 'in', wanted_out_of_date_list) | list }}"
|
|
|
|
- name: "Verify packages pip, vault-cli, yamllint, docker"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "'pip' in pip3_updated_list"
|
|
- "pip3_outdated_list is not defined"
|
|
|
|
- name: "Print up-to-date packages"
|
|
ansible.builtin.debug:
|
|
msg: "{{ pip3_updated_list }}"
|