tickets #17702


saltstack: add repos before packages get installed

Added by tampakrap over 7 years ago. Updated over 6 years ago.

Configuration management (CM)
Target version:
Start date:
Due date:
% Done:


Estimated time:


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

Actions #1

Updated by tampakrap over 7 years ago

  • Private changed from Yes to No
Actions #2

Updated by cboltz over 7 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.

Actions #3

Updated by tampakrap over 7 years ago

this is not a sufficient solution, packages and repositories might get installed in a formula as well. I want to ensure that salt will call all pkgrepo resources before it calls any pkg resource

Actions #4

Updated by cboltz over 7 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.)

Actions #5

Updated by tampakrap over 7 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.

Actions #6

Updated by cboltz about 7 years ago

Niels, is this something you can answer? ;-)

Actions #7

Updated by aboe76 about 7 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.

pkg options:

extend stuff

Hopefully this will help with building formulas

Actions #8

Updated by tampakrap over 6 years ago

  • Status changed from New to Closed

closing because it's nothing we can do, and upstream is aware (and not really willing to add the functionality from my understanding)


Also available in: Atom PDF