Search code examples
salt-project

Update all installed packages except kernels


I am trying to create a state that will update all the installed packages except Kernels. I have the following state that updates all the installed packages:

common_uptodate:
  pkg.uptodate:
    - refresh: True
    - order: last

However, it does not support the exclude flag.

Does anyone have a solution to do something like this?

Thanks.


Solution

  • If your minion's are using APT as a package manager, i would suggest to use the saltstack module aptpkg with the "hold" function. You could try to use it like that:

    run_pkg_hold:
      module.run:
        - name: pkg.hold
        - pkgs: kernelpackages...
    

    You could use an workaround by running the specific package hold command on the minion, using cmd.run: (as your upgrade will be be performed at last there should be no problem)

    run_pkg_hold:
      cmd.run:
        - name: 'apt-mark hold <pkg-name>'
    

    It depends on which OS your minion got.