mirror of
https://github.com/roles-ansible/ansible_role_packages.git
synced 2024-08-16 10:19:51 +02:00
60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
---
|
|
- name: Update apt repo-cache on debian/ubuntu hosts
|
|
become: true
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
when:
|
|
- ansible_pkg_mgr == "apt"
|
|
|
|
- name: Update dnf repo-cache on RHEL/Fedora hosts
|
|
become: true
|
|
ansible.builtin.dnf:
|
|
update_cache: true
|
|
when:
|
|
- ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 8
|
|
|
|
- name: Create Package installation list
|
|
block:
|
|
- name: Adding Advances Packages to installation list
|
|
ansible.builtin.set_fact:
|
|
l3d_pkgs__advanced: []
|
|
when:
|
|
not l3d_pkgs__install_advanced | bool
|
|
|
|
- name: Adding Python Packages to installation list
|
|
ansible.builtin.set_fact:
|
|
ll3d_pkgs__python: []
|
|
when:
|
|
not l3d_pkgs__install_python | bool
|
|
|
|
- name: Adding CLI Packages to installation list
|
|
ansible.builtin.set_fact:
|
|
l3d_pkgs__cli: []
|
|
when:
|
|
not l3d_pkgs__install_cli | bool
|
|
|
|
- name: Combine Lists
|
|
ansible.builtin.set_fact:
|
|
l3d_pkgs__install: "{{ l3d_pkgs__base + l3d_pkgs__advanced + l3d_pkgs__python + l3d_pkgs__cli + l3d_pkgs__install_extra_packages }}"
|
|
|
|
- name: Show l3d_pkgs__install on verbose run
|
|
ansible.builtin.debug:
|
|
msg: "{{ l3d_pkgs__install }}"
|
|
verbosity: 1
|
|
rescue:
|
|
- name: Show l3d_pkgs__install on verbose run
|
|
ansible.builtin.debug:
|
|
msg: "{{ l3d_pkgs__install }}"
|
|
verbosity: 1
|
|
|
|
- name: Error Info
|
|
ansible.builtin.fail:
|
|
msg: "Error creating list of packages for installation."
|
|
|
|
- name: Install selected Packages
|
|
become: true
|
|
ansible.builtin.package:
|
|
name: "{{ item }}"
|
|
state: "{{ l3d_pkgs__package_state }}"
|
|
loop: "{{ l3d_pkgs__install | flatten(1) }}"
|