ansible-keycloak/roles/keycloak_quarkus/tasks/fastpackages.yml

22 lines
763 B
YAML
Raw Permalink Normal View History

2022-04-07 12:07:08 +00:00
---
2022-05-11 09:33:52 +00:00
- name: Check packages to be installed
block:
2022-04-07 12:07:08 +00:00
- name: "Check if packages are already installed"
ansible.builtin.command: "rpm -q {{ packages_list | join(' ') }}"
args:
warn: no
register: rpm_info
changed_when: rpm_info.failed
rescue:
- name: "Add missing packages to the yum install list"
ansible.builtin.set_fact:
packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | map('regex_findall', 'package (.+) is not installed$') | flatten }}"
when: rpm_info.failed
- name: "Install packages: {{ packages_to_install | join(',') }}"
2022-04-07 12:07:08 +00:00
become: yes
ansible.builtin.yum:
name: "{{ packages_to_install }}"
state: present
when: packages_to_install | default([]) | length > 0