packages-installed

Example:

# Install the 'htop' and 'zile' packages using the system package manager.
- packages-installed:
    packages:
    - htop
    - zile

Description

Install a list of packages, including (optionally) the package managers that are used to install them.

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

Resources

Variables

Name Type Default Description

packages

list --

The list of packages to install. Required

become

boolean True

Whether to use root permissions to install the packages.

no_pkg_mgrs

boolean False

Don't try to install necessary package managers.

Examples

Example 1

Install the 'htop' and 'zile' packages using the system package manager.

Code
- packages-installed:
    packages:
    - htop
    - zile
Description

The easiest way to use this is to just use a list of strings as input. This will only work if the packages you want to install have the same name on all the relevant target platforms.

Example 2

Install the 'htop' and 'fortune' packages using the system package manager.

Code
- packages-installed:
    packages:
    - htop
    - name: fortune
      become: true
      pkgs:
        debian: fortune-mod
        default: fortune
Description

As the 'fortune' package is named differently on Debian platforms, we need to provide more details in our packages value.

Code

doc:
  short_help: Install a list of packages.
  help: |
    Install a list of packages, including (optionally) the package managers that are used to install them.

    More information and examples to come, for now please refer to the frecklet::pkg frecklet as well as [freckfrackery.install-pkgs Ansible role](https://gitlab.com/freckfrackery/freckfrackery.install-pkgs/blob/master/README.md) for more information.
  references:
    "'freckfrackery.install-pkgs Ansible role": https://gitlab.com/freckfrackery/freckfrackery.install-pkgs/blob/master/README.md
  examples:
  - title: Install the 'htop' and 'zile' packages using the system package manager.
    desc: |
      The easiest way to use this is to just use a list of strings as input. This will only work if the packages you
      want to install have the same name on all the relevant target platforms.
    vars:
      packages:
      - htop
      - zile
  - title: Install the 'htop' and 'fortune' packages using the system package manager.
    desc: |
      As the 'fortune' package is named differently on Debian platforms, we need to provide more details in our ``packages`` value.
    vars:
      packages:
      - htop
      - name: fortune
        become: true
        pkgs:
          debian: fortune-mod
          default: fortune

args:
  packages:
    doc:
      short_help: The list of packages to install.
    required: true
    type: list
    cli:
      param_type: argument
  no_pkg_mgrs:
    required: false
    type: boolean
    cli:
      is_flag: true
      param_decls:
      - --no-pkg-mgrs
    default: false
    doc:
      short_help: Don't try to install necessary package managers.
  become:
    doc:
      short_help: Whether to use root permissions to install the packages.
    type: boolean
    default: true
    required: false
meta:
  tags:
  - featured-frecklecutable
  - install
  - package-management
  - package-manager

frecklets:

- task:
    include-type: include
  frecklet:
    name: freckfrackery.install-pkgs
    type: ansible-role
    skip: '{{:: no_pkg_mgrs ::}}'
    resources:
      ansible-role:
      - freckfrackery.install-pkgs
      - freckfrackery.install-pkg-mgrs
      - freckfrackery.install-conda
      - freckfrackery.install-nix
      - freckfrackery.install-vagrant
      - geerlingguy.homebrew
      - elliotweiser.osx-command-line-tools
    properties:
      idempotent: true
      elevated: '{{:: become ::}}'
    desc:
      short: install packages (incl. pkg-mgrs)
      long: |
        Install the following packages:

        {{:: packages | to_yaml ::}}
  vars:
    install_become: '{{:: become ::}}'
    install_packages: '{{:: packages ::}}'
- task:
    loop: '{{:: packages ::}}'
  frecklet:
    name: install
    type: ansible-module
    skip: '{{:: no_pkg_mgrs | negate ::}}'
    properties:
      idempotent: true
    desc:
      short: install packages (no pkg-mgrs)
      long: |
        Install the following packages:

        {{:: packages | to_yaml ::}}

        Install all missing packages managers that are necessary for this list of packages.
  vars:
    install_become: '{{:: become ::}}'
    packages:
    - '{{ item }}'
frecklecute packages-installed --help

Usage: frecklecute packages-installed [OPTIONS] PACKAGES

  Install a list of packages, including (optionally) the package managers
  that are used to install them.

  More information and examples to come, for now please refer to the
  frecklet::pkg frecklet as well as [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
                          packages.
  --no-pkg-mgrs           Don't try to install necessary package managers.
  --help                  Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.packages_installed.PackagesInstalled
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class PackagesInstalled(AutoPycklet):
    """Install a list of packages, including (optionally) the package managers that are used to install them.

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

       Args:
         become: Whether to use root permissions to install the packages.
         no_pkg_mgrs: Don't try to install necessary package managers.
         packages: The list of packages to install.

    """

    FRECKLET_ID = "packages-installed"

    become: bool = None
    no_pkg_mgrs: bool = None
    packages: List = None


    def __post_init__(self):
        super(PackagesInstalled, self).__init__(var_names=["become", "no_pkg_mgrs", "packages"])


frecklet_class = PackagesInstalled
# -*- coding: utf-8 -*-


#
# module path: pycklets.packages_installed.PackagesInstalled
#


from pyckles import AutoPycklet

class PackagesInstalled(AutoPycklet):
    """Install a list of packages, including (optionally) the package managers that are used to install them.

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

       Args:
         become: Whether to use root permissions to install the packages.
         no_pkg_mgrs: Don't try to install necessary package managers.
         packages: The list of packages to install.

    """

    FRECKLET_ID = "packages-installed"

    def __init__(self, become=True, no_pkg_mgrs=None, packages=None):

        super(PackagesInstalled, self).__init__(var_names=["become", "no_pkg_mgrs", "packages"])
        self._become = become
        self._no_pkg_mgrs = no_pkg_mgrs
        self._packages = packages

    @property
    def become(self):
        return self._become

    @become.setter
    def become(self, become):
        self._become = become

    @property
    def no_pkg_mgrs(self):
        return self._no_pkg_mgrs

    @no_pkg_mgrs.setter
    def no_pkg_mgrs(self, no_pkg_mgrs):
        self._no_pkg_mgrs = no_pkg_mgrs

    @property
    def packages(self):
        return self._packages

    @packages.setter
    def packages(self, packages):
        self._packages = packages



frecklet_class = PackagesInstalled