fix: issue with OS detection
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
vincent 2023-10-24 22:45:58 +02:00
parent 53fd26805d
commit ed665c03da

View File

@ -16,20 +16,20 @@
changed_when: false changed_when: false
register: arch register: arch
- name: Install python for rocky #- name: Install python for rocky
ansible.builtin.raw: dnf install python3 --assumeyes # ansible.builtin.raw: dnf install python3 --assumeyes
changed_when: false #changed_when: false
when: rocky.stdout #when: rocky.stdout
- name: Install python for debian #- name: Install python for debian
ansible.builtin.raw: apt install python3 --assume-yes # ansible.builtin.raw: apt install python3 --assume-yes
changed_when: false #changed_when: false
when: debian.stdout #when: debian.stdout
- name: Install python on arch - name: Install python on arch
ansible.builtin.raw: pacman -Sy python --noconfirm ansible.builtin.raw: pacman -Sy python --noconfirm
changed_when: false changed_when: false
when: arch.stdout when: arch.stdout is match(".*Arch Linux.*")
- name: Add local repo to mirrorlist - name: Add local repo to mirrorlist
become: true become: true
@ -38,14 +38,15 @@
line: 'Server= {{ system_arch_local_mirror }}/$repo/os/$arch' line: 'Server= {{ system_arch_local_mirror }}/$repo/os/$arch'
state: present state: present
insertbefore: BOF insertbefore: BOF
when: system_arch_local_mirror is defined and arch.stdout when: system_arch_local_mirror is defined and arch.stdout is match(".*Arch Linux.*")
- name: Update archlinux-keyring - name: Update archlinux-keyring
community.general.pacman: community.general.pacman:
state: latest state: latest
name: archlinux-keyring name: archlinux-keyring
become: true become: true
when: arch.stdout when: arch.stdout is match(".*Arch Linux.*")
- name: Upgrade system for arch - name: Upgrade system for arch
community.general.pacman: community.general.pacman:
@ -55,7 +56,8 @@
update_cache: true update_cache: true
become: true become: true
register: upgrade_arch register: upgrade_arch
when: arch.stdout when: arch.stdout is match(".*Arch Linux.*")
- name: Upgrade system for debian - name: Upgrade system for debian
ansible.builtin.apt: ansible.builtin.apt:
@ -63,15 +65,15 @@
only_upgrade: true only_upgrade: true
upgrade: full upgrade: full
become: true become: true
when: debian.stdout when: debian.stdout is match(".*Debian.*")
register: upgrade_debian register: upgrade_debian
- name: Reboot updates to apply - name: Reboot updates to apply
ansible.builtin.reboot: ansible.builtin.reboot:
reboot_timeout: 3600 reboot_timeout: 3600
when: when:
(arch.stdout and (upgrade_arch.changed and upgrade_arch.packages is defined and "linux" in upgrade_arch.packages)) (arch.stdout is match(".*Arch Linux.*") and (upgrade_arch.changed and upgrade_arch.packages is defined and "linux" in upgrade_arch.packages))
or (debian.stdout and upgrade_debian.changed) or (debian.stdout is match(".*Debian.*") and upgrade_debian.changed)
become: true become: true
- name: Collect only selected facts - name: Collect only selected facts
@ -90,7 +92,7 @@
ansible.builtin.package: ansible.builtin.package:
state: present state: present
name: inetutils name: inetutils
when: arch.stdout when: ansible_os_family == "Archlinux"
- name: Sudoers install - name: Sudoers install
ansible.builtin.package: ansible.builtin.package: