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

77 lines
2.8 KiB
YAML

---
- name: Update repo-cache for debian/ubuntu
become: true
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
when:
- ansible_pkg_mgr == "apt"
- name: Update repo-cache for debian/ubuntu
become: true
ansible.builtin.dnf:
update_cache: true
when:
- ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 8
- name: Install base packages for all operating systems
become: true
ansible.builtin.package:
name: "{{ base__packages }}"
state: "{{ base__package_state }}"
- name: Install python3 for all non-legacy systems
become: true
ansible.builtin.package:
name: "{{ base__python3_packages }}"
state: "{{ base__package_state }}"
when: |
ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 16.0 or
ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 7 or
ansible_distribution == 'Debian' and ansible_distribution_version | float >= 7
- name: Install python for systems where python3 packages are renamed to python
become: true
ansible.builtin.package:
name: "{{ base__python_packages }}"
state: "{{ base__package_state }}"
when: ansible_os_family == 'Archlinux'
- name: Install packages for all non-legacy systems
become: true
ansible.builtin.package:
name: "{{ base__modern_packages }}"
state: "{{ base__package_state }}"
when: |
ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 16.0 or
ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 7 or
ansible_distribution == 'Debian' and ansible_distribution_version | float >= 8 or
ansible_os_family == 'Archlinux'
- name: Install packages for all non-legacy Debian/Ububntu systems
become: true
ansible.builtin.package:
name: "{{ base__debian_packages }}"
state: "{{ base__package_state }}"
when: |
ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 16.0 or
ansible_distribution == 'Debian' and ansible_distribution_version | float >= 8
- name: Install packages for all reasonable non-legacy systems
become: true
ansible.builtin.package:
name: "{{ base__linux_packages }}"
state: "{{ base__package_state }}"
when: |
ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 18.0 or
ansible_distribution == 'Fedora' and ansible_distribution_version | float >= 32 or
ansible_distribution == 'Debian' and ansible_distribution_version | float >= 9 or
ansible_os_family == 'Archlinux'
- name: Install mailx on debian
become: true
ansible.builtin.package:
name:
- bsd-mailx
state: "{{ base__package_state }}"
when: ansible_distribution == 'Debian' and ansible_distribution_version | float >= 7 and base__install_mailx | bool