Skip to main content

Create

Install a package.

Installs the package with apt-get install, at the version when one is given. A package that is installed, at that version when one is given, does not change and reports changed: false. It runs on the Debian family only, and elsewhere reports skipped.

osapi client node package create [flags]

Examples​

# Install a package
osapi client node package create --target web-01 --name tree

Result​

With the default settings, each example does this on the host:

ExampleOn the host
Install a packageruns apt-get install -y -- tree

The command fails in these cases:

CallFlagsFails with
A name that is an option--name -oAPT::Get=xnot a valid package name
A name longer than 255 characters--name aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanot a valid package name
A version that is an option--name tree --version -xnot a valid package version
A version longer than 255 characters--name tree --version 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111not a valid package version

Permission​

It needs the package:write permission. osapi token roles get --name <role> shows what a role grants.

Flags​

FlagDescriptionDefault
--nameThe package to install, such as curl (required)
-T, --targetTarget: _all, _any, hostname, or label (group:web.dev)_all
--versionThe version to install, such as 8.5.0-2ubuntu10; the newest when empty

Global flags​

FlagDescriptionDefault
-d, --debugEnable or disable debug mode
-j, --jsonEnable JSON output
-f, --osapi-filePath to config file/etc/osapi/osapi.yaml
--urlURL the client will connect tohttp://0.0.0.0:8080

Output tells how the result is printed, and what --json gives.