1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_packages.git synced 2024-08-16 10:19:51 +02:00
ansible_role_packages/tasks/packages.yml

61 lines
1.7 KiB
YAML
Raw Normal View History

2020-08-28 13:32:16 +02:00
---
2023-07-31 16:45:00 +02:00
- name: Update apt repo-cache on debian/ubuntu hosts
become: true
ansible.builtin.apt:
update_cache: true
2020-11-11 01:23:46 +01:00
cache_valid_time: 3600
when:
- ansible_pkg_mgr == "apt"
2023-07-31 16:45:00 +02:00
- name: Update dnf repo-cache on RHEL/Fedora hosts
become: true
ansible.builtin.dnf:
update_cache: true
when:
2020-11-11 11:11:17 +01:00
- ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 8
2023-07-31 16:45:00 +02:00
- name: Create Package installation list
2023-07-31 18:18:04 +02:00
block:
2023-07-31 16:45:00 +02:00
- name: Adding Advances Packages to installation list
ansible.builtin.set_fact:
2023-07-31 18:18:04 +02:00
l3d_pkgs__advanced: []
2023-07-31 16:45:00 +02:00
when:
2023-07-31 18:18:04 +02:00
not l3d_pkgs__install_advanced | bool
2023-07-31 16:45:00 +02:00
- name: Adding Python Packages to installation list
ansible.builtin.set_fact:
2023-07-31 18:18:04 +02:00
ll3d_pkgs__python: []
2023-07-31 16:45:00 +02:00
when:
2023-07-31 18:18:04 +02:00
not l3d_pkgs__install_python | bool
2020-08-28 13:32:16 +02:00
2023-07-31 16:45:00 +02:00
- name: Adding CLI Packages to installation list
ansible.builtin.set_fact:
2023-07-31 18:18:04 +02:00
l3d_pkgs__cli: []
2023-07-31 16:45:00 +02:00
when:
2023-07-31 18:18:04 +02:00
not l3d_pkgs__install_cli | bool
2023-07-31 16:45:00 +02:00
2023-07-31 18:18:04 +02:00
- name: Combine Lists
2023-07-31 16:45:00 +02:00
ansible.builtin.set_fact:
2023-07-31 18:18:04 +02:00
l3d_pkgs__install: "{{ l3d_pkgs__base + l3d_pkgs__advanced + l3d_pkgs__python + l3d_pkgs__cli + l3d_pkgs__install_extra_packages }}"
2023-07-31 16:45:00 +02:00
2023-10-28 00:16:35 +02:00
- name: Show l3d_pkgs__install on verbose run # noqa: H500
2023-07-31 16:45:00 +02:00
ansible.builtin.debug:
msg: "{{ l3d_pkgs__install }}"
verbosity: 1
rescue:
2023-10-28 00:16:35 +02:00
- name: Show l3d_pkgs__install on verbose run # noqa: H500
2023-07-31 18:18:04 +02:00
ansible.builtin.debug:
msg: "{{ l3d_pkgs__install }}"
verbosity: 1
- name: Error Info
ansible.builtin.fail:
msg: "Error creating list of packages for installation."
2023-07-31 16:45:00 +02:00
- name: Install selected Packages
2020-08-29 15:00:05 +02:00
become: true
ansible.builtin.package:
2023-07-31 16:45:00 +02:00
name: "{{ item }}"
state: "{{ l3d_pkgs__package_state }}"
2023-08-01 21:27:00 +02:00
loop: "{{ l3d_pkgs__install | flatten(1) }}"