#81847·ansible

dnf/yum connects to internet while package is already installed in offline environment

Author: avdlandCreated Oct 3, 2023Updated Sep 17, 2026
Labelsbugverifiedaffects_2.15

Summary

When I run the node exporter playbook in an offline environment on RedHat Linux where SELinux is enabled, the playbook wants to update the yum cache. Since this is an offline environment, this yum cache update will fail. The packages are already installed so there should be no need to update the yum cache. Even if I set the cacheonly parameter to true, the task will still fail because the cache is empty. The playbook: https://github.com/prometheus-community/ansible/tree/main/roles/node_exporter The task: https://github.com/prometheus-community/ansible/blob/main/roles/node_exporter/tasks/selinux.yml

Issue Type

Bug Report

Component Name

yum

Ansible Version

ansible [core 2.15.4]

Configuration

CONFIG_FILE() = None

OS / Environment

RHEL 9 with SELinux enabled

Steps to Reproduce

Run the https://github.com/prometheus-community/ansible/tree/main/roles/node_exporter playbook in an offline environment on RedHat with SELinux enabled.

Expected Results

It will run succesfully

Actual Results

"cannot update repo metadata" and "cache is empty" (when cacheonly=true) fatal: [vm]: FAILED! => {"changed": false, "msg": "Cache-only enabled but no cache for 'rhel-9-for-x86_64-supplementary-rhui-rpms'", "rc": 1, "results": []}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct