package-installed

Example:

# Install the 'htop' package.
- package-installed:
    package: htop

Description

Install a single package, including the package manager that that was chosen, if necessary.

More information and examples to come, for now please refer to the freckfrackery.install-pkgs Ansible role for more information.

Variables

Name Type Default Description

package

['string', 'dict'] --

The package name. Required

become

boolean True

Whether to use root permissions to install the package.

no_pkg_mgr

boolean False

Don't try to install a necessary package manager.

Examples

Example 1

Install the 'htop' package.

Code
- package-installed:
    package: htop
Description

This uses the system package manager to install the 'htop' package. If the package is named differently on a platform, this won't work.

Example 2

Install the 'fortunes' package using the proper package name for a platform.

Code
- package-installed:
    package:
      name: fortune
      pkgs:
        debian: fortune-mod
        redhat: fortune
        darwin: fortune
Description

This uses the default system package manager to install the 'fortune' package. As the 'fortunes' package is named differently on different platforms, this is how to specify platform-dependent package names.

The 'name' property is not important here (except as a fall-back if so configured), but needs to be specified nonetheless.

Example 3

Install the 'fortune' package using a special package name for one platform.

Code
- package-installed:
    package:
      name: fortune
      pkgs:
        debian: fortune-mod
        default: fortune
Description

This is similar to the example above, except that we assume that the 'fortune' package name will always be 'fortune', except for the platforms we specify.

Example 4

Install the 'htop' package using the 'nix' package manager.

Code
- package-installed:
    package:
      name: htop
      pkg_mgr: nix
Description

This installs the 'nix' package manager itself if it isn't available yet.

Command-line

frecklecute package-installed --help

Usage: frecklecute package-installed [OPTIONS] PACKAGE

  Install a single package, including the package manager that that was
  chosen, if necessary.

  More information and examples to come, for now please refer to the
  [freckfrackery.install-pkgs Ansible
  role](https://gitlab.com/freckfrackery/freckfrackery.install-
  pkgs/blob/master/README.md) for more information.

Options:
  --become / --no-become          Whether to use root permissions to install
                                  the package.
  --no-pkg-mgr / --no-no-pkg-mgr  Don't try to install a necessary package
                                  manager.
  --help                          Show this message and exit.