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
|
2020-11-11 00:39:13 +01:00
|
|
|
become: true
|
2021-03-12 22:18:54 +01:00
|
|
|
ansible.builtin.apt:
|
2021-01-18 10:47:52 +01:00
|
|
|
update_cache: true
|
2020-11-11 01:23:46 +01:00
|
|
|
cache_valid_time: 3600
|
2020-11-11 00:39:13 +01:00
|
|
|
when:
|
2021-03-12 22:18:54 +01:00
|
|
|
- ansible_pkg_mgr == "apt"
|
2020-11-11 00:39:13 +01:00
|
|
|
|
2023-07-31 16:45:00 +02:00
|
|
|
- name: Update dnf repo-cache on RHEL/Fedora hosts
|
2020-11-11 00:39:13 +01:00
|
|
|
become: true
|
2021-03-12 22:18:54 +01:00
|
|
|
ansible.builtin.dnf:
|
2021-01-18 10:47:52 +01:00
|
|
|
update_cache: true
|
2020-11-11 00:39:13 +01:00
|
|
|
when:
|
2020-11-11 11:11:17 +01:00
|
|
|
- ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 8
|
2020-11-11 00:39:13 +01:00
|
|
|
|
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:
|
2024-04-27 02:43:22 +02:00
|
|
|
packages__advanced: []
|
2023-07-31 16:45:00 +02:00
|
|
|
when:
|
2024-04-27 02:43:22 +02:00
|
|
|
not packages__install_advanced | bool
|
2023-07-31 16:45:00 +02:00
|
|
|
|
|
|
|
- name: Adding Python Packages to installation list
|
|
|
|
ansible.builtin.set_fact:
|
2024-04-27 02:43:22 +02:00
|
|
|
lpackages__python: []
|
2023-07-31 16:45:00 +02:00
|
|
|
when:
|
2024-04-27 02:43:22 +02:00
|
|
|
not packages__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:
|
2024-04-27 02:43:22 +02:00
|
|
|
packages__cli: []
|
2023-07-31 16:45:00 +02:00
|
|
|
when:
|
2024-04-27 02:43:22 +02:00
|
|
|
not packages__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:
|
2024-04-27 02:43:22 +02:00
|
|
|
packages__install: "{{ packages__base + packages__advanced + packages__python + packages__cli + packages__install_extra_packages }}"
|
2023-07-31 16:45:00 +02:00
|
|
|
|
2024-04-27 02:43:22 +02:00
|
|
|
- name: Show packages__install on verbose run # noqa: H500
|
2023-07-31 16:45:00 +02:00
|
|
|
ansible.builtin.debug:
|
2024-04-27 02:43:22 +02:00
|
|
|
msg: "{{ packages__install }}"
|
2023-07-31 16:45:00 +02:00
|
|
|
verbosity: 1
|
|
|
|
rescue:
|
2024-04-27 02:43:22 +02:00
|
|
|
- name: Show packages__install on verbose run # noqa: H500
|
2023-07-31 18:18:04 +02:00
|
|
|
ansible.builtin.debug:
|
2024-04-27 02:43:22 +02:00
|
|
|
msg: "{{ packages__install }}"
|
2023-07-31 18:18:04 +02:00
|
|
|
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
|
2021-03-12 22:18:54 +01:00
|
|
|
ansible.builtin.package:
|
2023-07-31 16:45:00 +02:00
|
|
|
name: "{{ item }}"
|
2024-04-27 02:43:22 +02:00
|
|
|
state: "{{ packages__package_state }}"
|
|
|
|
loop: "{{ packages__install | flatten(1) }}"
|