Project

General

Profile

Actions

tickets #17702

closed

saltstack: add repos before packages get installed

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

Status:
Closed
Priority:
Normal
Assignee:
Category:
Configuration management (CM)
Target version:
-
Start date:
2017-03-14
Due date:
% Done:

0%

Estimated time:

Description

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 about 7 years ago

  • Private changed from Yes to No
Actions #2

Updated by cboltz about 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 about 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 about 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 about 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 almost 7 years ago

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

Actions #7

Updated by aboe76 almost 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:
https://docs.saltstack.com/en/latest/ref/states/all/salt.states.pkg.html#salt.states.pkg.installed

extend stuff
https://docs.saltstack.com/en/latest/ref/states/extend.html

Hopefully this will help with building formulas

Actions #8

Updated by tampakrap about 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)

Actions

Also available in: Atom PDF