Skip to content

Commit

Permalink
Better OS detection
Browse files Browse the repository at this point in the history
  • Loading branch information
bviktor committed Nov 15, 2024
1 parent e1dbf61 commit 5b1aaa0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions tasks/ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- name: Update package manager cache
apt:
update_cache: true
when: ansible_pkg_mgr == 'apt'
when: ansible_os_family == 'Debian'

# TODO add-apt-repository / apt_repository doesn't support HTTPS so do it manually
#- name: Add Ansible PPA
Expand All @@ -19,29 +19,29 @@
gpg_id: '6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367'
repo_file: 'ansible'
package: 'ansible'
when: (ansible_pkg_mgr == 'apt') and (ansible_architecture != 'aarch64')
when: (ansible_os_family == 'Debian') and (ansible_architecture != 'aarch64')

#- name: Install Ansible
# apt:
# name: ansible
# state: latest
# when: ansible_pkg_mgr == 'apt'
# when: ansible_os_family == 'Debian'

- name: Enable EPEL repo
dnf:
name: epel-release
state: latest
when: (ansible_pkg_mgr == 'dnf') and (ansible_distribution != 'Fedora')
when: (ansible_os_family == 'RedHat') and (ansible_distribution != 'Fedora')

- name: Install Ansible
dnf:
name: ansible
state: latest
when: ansible_pkg_mgr == 'dnf'
when: ansible_os_family == 'RedHat'

- name: Show IP on login screen
replace:
path: /etc/issue
regexp: '(Ubuntu .*)\\l$'
replace: '\1\\l (\\4)'
when: ansible_pkg_mgr == 'apt'
when: ansible_os_family == 'Debian'
8 changes: 4 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#- include_tasks: repo.yml
# TODO extend to EL
- include_tasks: release.yml
when: ansible_pkg_mgr == 'apt'
when: ansible_os_family == 'Debian'
# Installing Ansible doesn't belong here
#- include_tasks: ansible.yml
- include_tasks: update_ubuntu.yml
when: ansible_pkg_mgr == 'apt'
when: ansible_os_family == 'Debian'
- include_tasks: update_el8.yml
when: ansible_pkg_mgr == 'dnf'
when: ansible_os_family == 'RedHat'
# TODO fix for ARM64
- include_tasks: hwe.yml
when: (ansible_virtualization_type != 'docker') and (ansible_pkg_mgr == 'apt') and (ansible_architecture != 'aarch64')
when: (ansible_virtualization_type != 'docker') and (ansible_os_family == 'Debian') and (ansible_architecture != 'aarch64')

0 comments on commit 5b1aaa0

Please sign in to comment.