2021-12-14 10:26:42 +00:00
|
|
|
---
|
|
|
|
- block:
|
|
|
|
- name: "Check if package {{ package_name }} is already installed"
|
2022-02-24 14:00:10 +00:00
|
|
|
ansible.builtin.command: rpm -q {{ package_name }}
|
2021-12-14 10:26:42 +00:00
|
|
|
args:
|
|
|
|
warn: no
|
|
|
|
register: rpm_info
|
|
|
|
changed_when: rpm_info.failed
|
|
|
|
|
|
|
|
rescue:
|
2022-02-15 12:14:36 +00:00
|
|
|
- name: "Add {{ package_name }} to the yum install list if missing"
|
2022-02-24 14:00:10 +00:00
|
|
|
ansible.builtin.set_fact:
|
2021-12-14 10:26:42 +00:00
|
|
|
packages_to_install: "{{ packages_to_install + [ package_name ] }}"
|
|
|
|
when: rpm_info.failed
|