Search code examples
salt-project

saltstack state for cuda setup - how to force apt-get --force-yes in salt pkg.installed


i have a state where i try to install cuda on an gpu server. The state correctly calles apt-get install cuda etc. but cant answer a second yes call for further dependencie

This is the output

          ID: package_cuda
    Function: pkg.installed
        Name: cuda
      Result: False
     Comment: Problem encountered installing package(s). Additional info follows:
              
              errors:
                  - E: There are problems and -y was used without --force-yes
     Started: 16:55:24.408065
    Duration: 17031.708 ms

This is the cuda state

include:
  - repos.pkgs.{{ salt['grains.get']('os') ~ '.' ~ salt['grains.get']('oscodename') }}.cuda

package_cuda:
  pkg:
    - installed
    - name: cuda
    - require:
      - pkgrepo: pkgrepo_cuda

package repo sate

pkgrepo_cuda:
  pkgrepo:
    - managed
    - humanname: nvidia cuda repo
    - name: deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64 / 
    - file: /etc/apt/sources.list.d/cuda.list
    - key_url: http://developer.download.nvidia.com/compute/cuda/repos/GPGKE

So something like apt-get install --force-yes option would be awesome in the docs i was lucky to find an option


Solution

  • one has to use the "force_yes" key. its not in the docs but one can get it from the salt util docs.

    package_cuda:
      pkg:
        - installed 
        - name: cuda-8-0
        # the installation may ask twice for driver
        - force_yes: True
        - require:
          - pkgrepo: pkgrepo_cuda