Add base role and playbook, molecule configuration

This commit is contained in:
Guido Grazioli 2021-12-14 11:26:42 +01:00
commit 187473447d
35 changed files with 3658 additions and 0 deletions

View file

@ -0,0 +1,14 @@
---
- block:
- name: "Check if package {{ package_name }} is already installed"
command: rpm -q {{ package_name }}
args:
warn: no
register: rpm_info
changed_when: rpm_info.failed
rescue:
- name: "If package {{ package_name }} is missing, add it to the yum install list."
set_fact:
packages_to_install: "{{ packages_to_install + [ package_name ] }}"
when: rpm_info.failed

View file

@ -0,0 +1,17 @@
---
- set_fact:
update_cache: true
packages_to_install: []
- name: "Check packages to be installed"
include_tasks: check.yml
loop: "{{ packages_list | flatten }}"
loop_control:
loop_var: package_name
- name: "Install packages: {{ packages_to_install }}"
become: yes
yum:
name: "{{ packages_to_install }}"
state: present
when: packages_to_install | length > 0