Search code examples
ubuntu-14.04salt-projectdeb

SaltStack state to install .deb package file and dependencies


I have a salt formula. On server I am using wkhtmltopdf tools. Ubuntu repo has this tool but it has an older version. I want to use the latest version.

I am doing the following to get it installed on minions manually.

$ wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
$ sudo apt-get install fontconfig libfontenc1 libjpeg-turbo8 libxfont1 x11-common xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils libxrender1
$ sudo dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb

I can do cmd.run for all these commands. Is there any better way of doing any of these steps?


Solution

  • You can specify a remote sources option in a Salt pkg state. You could try something like this

    cat stuff.sls
    
    my_pkgs:
      - pkg.installed:
        - pkgs:
          - fontconfig
          - libfontenc1
          - libjpeg-turbo8 
          - libxfont1
          - x11-common
          - xfonts-75dpi
          - xfonts-base
          - xfonts-encodings
          - xfonts-utils
          - libxrender1
    
    install_wkhtmltox:
      pkg.installed:
        - sources:
          - wkhtmltox: http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb