Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dont use Yum/Rpm task when packages are already installed #226

Closed
wants to merge 1 commit into from

Conversation

avdland
Copy link

@avdland avdland commented Sep 28, 2023

This should fix issue #225

@avdland avdland changed the title dont use Yum/Rpm task when packages are already installed fix: dont use Yum/Rpm task when packages are already installed Sep 28, 2023
@github-actions github-actions bot added bugfix and removed bugfix labels Sep 28, 2023
Copy link
Contributor

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically bypasses the real functionality of ansible.builtin.package. Rather than have a hacky workaround, we should probably switch to ansible.builtin.yum directly. This would allow tweaking the offline behavior with controlling the metadata update flags.

@gardar
Copy link
Member

gardar commented Sep 28, 2023

This basically bypasses the real functionality of ansible.builtin.package. Rather than have a hacky workaround, we should probably switch to ansible.builtin.yum directly. This would allow tweaking the offline behavior with controlling the metadata update flags.

Agreed, but there is no need to switch to the yum module, the package module is actually just a proxy on top of the yum module, which means you can pass any of the yum module parameters to the package module

@avdland
Copy link
Author

avdland commented Sep 28, 2023

While testing, I had set the cacheonly parameter to true, but then it complained that the cache was empty, and the task would still fail...
fatal: [vm]: FAILED! => {"changed": false, "msg": "Cache-only enabled but no cache for 'rhel-9-for-x86_64-supplementary-rhui-rpms'", "rc": 1, "results": []}

Signed-off-by: Albert van der Land <albertvanderland@gmail.com>
@avdland
Copy link
Author

avdland commented Sep 29, 2023

It seems that the disablerepo parameter does what I want. I've added a new variable, node_exporter_offline, which then disables the repos if true.

@avdland
Copy link
Author

avdland commented Sep 29, 2023

I do think the previous commit b41c938 is a better solution though... we shouldnt even have to run yum commands if the package is already installed

@SuperQ
Copy link
Contributor

SuperQ commented Sep 29, 2023

IMO this is a bug in Ansible's package module. It should not need to update caches or activate yum with state: present.

We have this issue with every role, they all depend on selinux. Not just node_exporter.

@avdland
Copy link
Author

avdland commented Oct 3, 2023

created new issue: ansible/ansible#81847

@gardar
Copy link
Member

gardar commented Oct 17, 2024

#225 (comment)

@gardar gardar closed this Oct 17, 2024
Copy link
Contributor

Docs Build 📝

This PR is closed and any previously published docsite has been unpublished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants