mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 20:13:59 -07:00
Ensure that apt is always chosen on debian/ubuntu (#44413)
One can install alternate packages managers on debuntu machines. However, doing so doesn't mean you want to suddenly start using them. Add in a check similar to the fedora yum/dnf check that sets apt as the pkg_mgr if the ansible_os_family is Debian.
This commit is contained in:
parent
6d52afeed6
commit
27ac2fc67c
3 changed files with 32 additions and 0 deletions
|
@ -46,6 +46,30 @@
|
|||
setup:
|
||||
when: ansible_distribution == "Fedora"
|
||||
|
||||
# Verify correct default package manager for Debian/Ubuntu when Zypper installed
|
||||
- block:
|
||||
# Just make an executable file called "zypper" - installing zypper itself
|
||||
# consistently is hard - and we're not going to use it
|
||||
- name: install fake zypper
|
||||
file:
|
||||
state: touch
|
||||
mode: 0755
|
||||
path: /usr/bin/zypper
|
||||
- name: gather facts again
|
||||
setup:
|
||||
- name: validate output
|
||||
assert:
|
||||
that:
|
||||
- 'ansible_pkg_mgr == "apt"'
|
||||
always:
|
||||
- name: remove fake zypper
|
||||
file:
|
||||
path: /usr/bin/zypper
|
||||
state: absent
|
||||
- name: gather facts again
|
||||
setup:
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
##
|
||||
## package
|
||||
##
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue