41 lines
955 B
YAML
41 lines
955 B
YAML
---
|
|
- name: Installation selon distribution
|
|
hosts: all
|
|
become: yes
|
|
|
|
tasks:
|
|
- name: "Set when conditions"
|
|
set_fact:
|
|
is_dnf: "{{ ansible_distribution in ['RedHat', 'Rocky', 'Fedora', 'AlmaLinux'] }}"
|
|
is_apt: "{{ ansible_os_family == 'Debian' }}"
|
|
is_apk: "{{ ansible_os_family == 'Alpine' }}"
|
|
is_zypper: "{{ ansible_distribution == 'openSUSE Leap' }}"
|
|
|
|
- name: "Update RedHat family"
|
|
ansible.builtin.dnf:
|
|
update_cache: yes
|
|
name: '*'
|
|
state: latest
|
|
when: is_dnf
|
|
|
|
- name: "Update Debian family"
|
|
ansible.builtin.apt:
|
|
update_cache: yes
|
|
name: "*"
|
|
state: latest
|
|
when: is_apt
|
|
|
|
- name: "Alpine update"
|
|
apk:
|
|
update_cache: yes
|
|
available: yes
|
|
upgrade: yes
|
|
when: is_apk
|
|
|
|
- name: "OpenSUSE update"
|
|
zypper:
|
|
update_cache: yes
|
|
name: "*"
|
|
state: latest
|
|
when: is_zypper
|