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

Make installation idempotent. #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rhpvorderman
Copy link

Hi @edwins ,

First of all thanks for this ansible role. I first tried the other singularity role but it is way more involved, and it depends on golang dep, which is deprecated.

I like that this role is simple and efficient. Because of its simplicity it just works.

One disadvantage I noticed is that the installation always runs, even if singularity is already installed. This slows down deployment, and is especially annoying when you made a small update somewhere else in your playbook or when you are testing. I also noticed that the package installation won't happen on Debian, even though the package names are the same as in Ubuntu.

So with this PR:

  • singularity version is run to get the version. (singularity --version when the version is lower than 3). If singularity is not installed, then this command returns an empty string ''.
  • The checked version is compared to the desired version.
  • If the desired version is not installed the installation runs.

Also:

  • Use ansible_os_family because package names among the Debian family and among the RedHat family are interchangable.
  • Use state: present for the packages. There is no reason to keep updating the build packages on rerunning the role. Most distributions have only one version in their repo anyway.

@rhpvorderman
Copy link
Author

rhpvorderman commented Apr 30, 2021

@hexylena. I just notice that you did something similar. Stupid of me not to look. Sorry.

As a note singularity --version prints just the version number on older versions of singularity i.e. 2.x.x. But on singularity 3.x.x singularity --version prints: singularity version 3.x.x. On singularity version 3.x.x singularity version has the desired effect. That is taken into account in this branch, but it could also be applied as a patch to your branch.

@edwins
Copy link
Contributor

edwins commented Jul 23, 2021

@rhpvorderman I apologize for just noticing your pull request and will review it shortly.

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

Successfully merging this pull request may close these issues.

2 participants