Skip to content

[Bug] Missing dependencies on select package manager #30

@prakasa1904

Description

@prakasa1904

I found error on task Gather the package facts:

- name: Gather the package facts
  ansible.builtin.package_facts:
    manager: auto

sometimes it will causing error because of dependencies is missing:

fatal: [ansible-inventory]: FAILED! => {"changed": false, "msg": "Could not detect a supported package manager from the following list: ['portage', 'pkg', 'pacman', 'apt', 'rpm', 'pkg_info', 'apk'], or the required Python library is not installed. Check warnings for details."}

To minimalize changes, I propose solution to adding validation to install dependencies by specific OS family before task Gather the package facts:

# Install dependencies on OS family ['RedHat' |  'Debian' | 'Archlinux']
- ansible.builtin.include_tasks: deps-{{ ansible_os_family }}.yml
  when: ansible_os_family in ['RedHat', 'Debian', 'Archlinux']

- name: Gather the package facts
  ansible.builtin.package_facts:
    manager: auto

deps-Debian.yml

---
- name: Install prerequisite packages
  ansible.builtin.apt:
    name: "{{ dependency_packages }}"
    state: present

deps-RedHat.yml

- name: Install prerequisite packages
  ansible.builtin.package:
    name: "{{ dependency_packages }}"
    state: present

dependency_packages set in file inside folder vars per OS family. All changes will adding new task below:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions