refactor: improve support for ostree systems #225
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The dependency on
ansible.utils.update_fact
is causing issue withsome users who now must install that collection in order to run
the role, even if they do not care about ostree.
The fix is to stop trying to set
ansible_facts.pkg_mgr
, and insteadforce the use of the ostree package manager with the
package:
moduleuse:
option. The strategy is - on ostree systems, set the flag__$ROLENAME_is_ostree
if the system is an ostree system. The flagwill either be undefined or
false
on non-ostree systems.Then, change every invocation of the
package:
module like this:This should ensure that the
use:
parameter is not used if the systemis non-ostree. The goal is to make the ostree support as unobtrusive
as possible for non-ostree systems.
The user can also set
__$ROLENAME_is_ostree: true
in the inventory or playif the user knows that ostree is being used and wants to skip the check.
Or, the user is concerned about the performance hit for ostree detection
on non-ostree systems, and sets
__$ROLENAME_is_ostree: false
to skipthe check.
The flag
__$ROLENAME_is_ostree
can also be used in the role or tests toinclude or exclude tasks from being run on ostree systems.
This fix also improves error reporting in the
get_ostree_data.sh
scriptwhen included roles cannot be found.
Signed-off-by: Rich Megginson [email protected]