saltstack: add repos before packages get installed
We need to check if it is possible to tell salt to add repos before it installs packages. If it is not possible, file an upstream ticket
#2 Updated by cboltz over 3 years ago
wild, untested guess: swap the "profile.zypper.packages" and "profile.zypper.repositories" includes in salt/profile/zypper/init.sls
(and ideally first merge my changes to move around that file to avoid merge conflicts later ;-)
I don't know if anything in salt/role/base.sls installs packages, but if so, you should also move the "profile.zypper" include to the first position there.
#4 Updated by cboltz over 3 years ago
Correct me if I'm wrong, but AFAIK formulas need to be include'd in salt/role/*.sls - and this would mean that making "profile.zypper" the first item in salt/role/base.sls should work.
That said - yes, a formula could add a repo, but a) that would (hopefully) be specific to that formula and get added before installing packages from it and b) I don't like the idea too much to drop in random repos with a formula - there's a reason we have openSUSE:infrastructure + subprojects. (In other words: formulas should not add any repos IMHO.)
#5 Updated by tampakrap over 3 years ago
you are overthinking it. I was just setting up an example to get you understand that pkgrepo needs to be called always before pkg.install. Puppet provides such a mechanism, where it collects all the equivalent pkgrepo resources and calls them before anything else on the system.
#7 Updated by aboe76 over 3 years ago
saltstack-formulas are regarded as single solutions for the service/package/config it should manage.
so if a formula installs a package from a repo, it should do something along the folowing line:
- provide a way to install the repo and refresh it.
- install the package after installing the repo.
or the you can do the following,
- formula to manage all repo's and refresh the repo's after something changes. (first rep in top.sls
- formula to install a pkg always after the formula that manage repos
Saltstack doesn't have the ability to change a module on a global scale, only per sls file.
you can override stuff or extend stuff per sls file.
Hopefully this will help with building formulas