Tacoscript - execute tasks with ease
Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Packages

Preface

Tacoscript comes with functions to install software packages via package manager on you system.

pkg.installed

The task pkg.installed ensures that the specified package(s) is installed in the managed host system.

pkg.installed has following format:

install-neovim:
  pkg.installed:
    - name: neovim
    - version: 0.4.3-3
    - refresh: true
    - shell: bash
    - require:
        - create-file
    - unless: neovim --version
    - onlyif: date +%c|grep -q "^Thu"

We can interpret this script as:

The desired state of the script ‘install-neovim’ neovim package in version 0.4.3-3 to be installed in the target host system. The bash shell will be used. Before running installation it will update list of available packages (refresh = true). If this script is executed under the Ubuntu/Debian Linux OS, the tacoscript will execute this command as:

apt update -y
apt install -y neovim=0.4.3-3

The script will be only executed after create-file script. So the tacoscript interpreter will make sure that the create-file script is executed before install-neovim and only if it was successful.

The commands will be executed only under the following conditions:

  • The package neovim is not installed yet, so neovim --version returns an error
  • Today is Thursday

You can specify multiple packages to be installed by using names field:

vim-family:
  pkg.installed:
    - refresh: true
    - names:
        - vim
        - neovim
        - vi

In this case vim, neovim and vi packages will be installed as e.g.

apt update
apt install -y vim neovim vi

When you use multiple packages, the version value will be applied to all packages. If version value is empty, tacoscript will install the latest versions of all packages.

List of supported parameters:
Note that the global parameters for conditionals, dependencies and templating are also supported.

name

required string

Name of the package to be installed.

Either name or names is required.

names

required array

Name contains the list of packages to be installed.

Either name or names is required.

shell

optional string

Shell is a program that takes commands from input and gives them to the operating system to perform. Known Linux shells are bash, sh, zsh etc. Windows supports cmd.exe shell.

version

optional string

Version of the package to be installed. If omitted, the tacoscript will install the latest default version.

refresh

optional boolean

If true, the tacoscript will update list of available packages, e.g. execute apt update under Ubuntu/Debian OS.

OS Support

OSOS PlatformPackage managerInstallation script to be executed, e.g. vim
macOSDarwinbrewbrew install vim
LinuxUbuntu/Debianapt (fallback to apt-get)apt install -y vim
LinuxCentOS/Redhatdnf (fallback to yum)dnf install -y vim
WindowsWindowschocochoco install -y vim

Note if a corresponding package manager is not installed on the host system, a fallback will be used. If both are not available, the script will fail.

pkg.uptodate

The task pkg.uptodate ensures that the specified package(s) is upgraded to the latest version.

pkg.uptodate has following format:

upgrade-neovim:
  pkg.uptodate:
    - name: neovim

This script will upgrade neovim package to the latest stable version. If this script is executed under the Ubuntu/Debian Linux OS, the tacoscript will execute this command as:

apt upgrade -y neovim

You can specify multiple packages to be installed by using names field:

vim-family-latest:
  pkg.uptodate:
    - refresh: true
    - names:
        - vim
        - neovim
        - vi

In this case vim, neovim and vi packages will be upgraded as e.g.

apt update
apt upgrade -y vim neovim vi

name

required string

Name of the package to be installed.

Either name or names is required.

names

required array

Name contains the list of packages to be installed.

Either name or names is required.

shell

optional string

See #pkg.installed for reverence.

refresh

required boolean

See #pkg.installed for reverence.

OS Support

OSOS PlatformPackage managerInstallation script to be executed, e.g. vim
macOSDarwinbrewbrew upgrade vim
LinuxUbuntu/Debianapt (fallback to apt-get)apt upgrade -y vim
LinuxCentOS/Redhatdnf (fallback to yum)dnf upgrade -y vim
WindowsWindowschocochoco upgrade -y vim

Note if a corresponding package manager is not installed on the host system, a fallback will be used. If both are not available, the script will fail. If the package is not yet installed, the behaviour will vary depending on the package manager e.g. brew will install this package and apt-get will fail.

pkg.removed

The task pkg.removed ensures that the specified package(s) is removed from the host system.

pkg.removed has following format:

delete-neovim:
  pkg.removed:
    - name: neovim

This script will delete neovim package. If this script is executed under the Ubuntu/Debian Linux OS, the tacoscript will execute this command as:

apt remove -y neovim

You can specify multiple packages to be removed by using names field:

vim-family-removed:
  pkg.removed:
    - names:
        - vim
        - neovim
        - vi

In this case vim, neovim and vi packages will be removed as e.g.

apt update
apt remove -y vim neovim vi

name

required string

Name of the package to be installed.

Either name or names is required.

names

required array

Name contains the list of packages to be installed.

Either name or names is required.

shell

optional string

refresh

required boolean

See #pkg.installed for reverence.

OS Support

OSOS PlatformPackage managerInstallation script to be executed, e.g. vim
macOSDarwinbrewbrew uninstall vim
LinuxUbuntu/Debianapt (fallback to apt-get)apt remove -y vim
LinuxCentOS/Redhatdnf (fallback to yum)dnf remove -y vim
WindowsWindowschocochoco uninstall -y vim

Note if a corresponding package manager is not installed on the host system, a fallback be used. If both are not available, the script will fail.