Closed luminouw closed 2 years ago
Cool, this looks good! In hindsight this can probably just be removed outright. Given the debian role doesn't add any new repos or anything I don't see why it should be upon the role to update cache...
What do you think?
I see your point, and I think it would be up to the user to make that call. Sometimes you just want to apply a single role and I think the role itself should make sure your cache is up to date to benefit from the latest version of the packages. Sometimes you include the role in a massive playbook, and then if every role updates the apt cache this is going to take forever :)
So maybe adding this as a variable/flag that the user could turn off if needed ?
Something like nagios_nrpe_apt_force_cache_update
?
Default : yes (this way you can just git clone and apply), if set to no, it's up to the user to take care of the state of his apt cache.
This makes the role idempotent on Debian platforms. When called in a separate task the "update_cache" option always return "changed". When combined with a package to be installed, it returns changed only if the package isn't already installed. It still always updates apt cache, so the following apt instructions will continue to benefit from a fresh cache.