hashicorp-executable-installed

Description

A utility frecklet to help install Hashicorp products.

Hashicorp tools (Packer, Terraform, Consul, ...) are built and hosted in a similar fashion, which is why it's convenient to have a wrapper frecklet like this. The 'terraform-installed', 'consul-installed', 'packer-installed' frecklets (and possibly others in the future) all use this frecklet as their base.

Variables

Name Type Default Description

product_name

string --

The name of the product. Required

version

string --

The version of the product. Required

dest

string --

The (absolute) path to the parent folder of the downloaded executable file.

exe_mode

string 0755

The mode for the executable file(s) (default: '0755').

group

string --

The group of the executable.

owner

string --

The owner of the executable.

Code

doc:
  short_help: Install a Hashicorp executable.
  help: |
    A utility frecklet to help install Hashicorp products.

    Hashicorp tools (Packer, Terraform, Consul, ...) are built and hosted in a similar fashion, which is why it's
    convenient to have a wrapper frecklet like this. The 'terraform-installed', 'consul-installed', 'packer-installed' frecklets (and possibly others in the future) all use this frecklet as their base.

args:
  _import: executable-downloaded
  product_name:
    doc:
      short_help: The name of the product.
    type: string
    required: true
    allowed:
    - nomad
    - packer
    - terraform
    - consul
    - vault
  version:
    doc:
      short_help: The version of the product.
    type: string
    required: true
  arch:
    doc:
      short_help: The architecture of the host system.
    type: string
    required: false
    allowed:
    - amd64
    - '386'
    - arm
    - arm64
    - mips
    - mips64
    - mipsle
    - ppc64le
    - s390x
  platform:
    doc:
      short_help: The platform of the host system.
    type: string
    required: false
    allowed:
    - linux
    - freebsd
    - darwin
    - openbsd
    - solaris
    - windows
  owner:
    doc:
      short_help: The owner of the executable.
    type: string
    required: false
    cli:
      metavar: USER
  group:
    doc:
      short_help: The group of the executable.
    type: string
    required: false
    empty: false
    cli:
      metavar: GROUP
frecklets:
- frecklet:
    name: hashicorp-executable-downloaded.at.yml
    type: ansible-tasklist
    desc:
      short_help: Download and extract one of the Hashicorp products.
    properties:
      idempotent: true
      internet: true
      elevated: '{{:: owner | true_if_not_empty ::}}'
    resources:
      ansible-tasklist:
      - hashicorp-executable-downloaded.at.yml
      - folder-exists.at.yml
      - file-downloaded.at.yml
      - archive-extracted.at.yml
      - executable-downloaded.at.yml
      - set-user-home-dir-var.at.yml
  vars:
    __dest__: '{{:: dest ::}}'
    __owner__: '{{:: owner ::}}'
    __group__: '{{:: group ::}}'
    __mode__: '{{:: exe_mode ::}}'
    __product_name__: '{{:: product_name ::}}'
    __version__: '{{:: version ::}}'
frecklecute hashicorp-executable-installed --help

Usage: frecklecute hashicorp-executable-installed [OPTIONS]

  A utility frecklet to help install Hashicorp products.

  Hashicorp tools (Packer, Terraform, Consul, ...) are built and hosted in a
  similar fashion, which is why it's convenient to have a wrapper frecklet
  like this. The 'terraform-installed', 'consul-installed', 'packer-
  installed' frecklets (and possibly others in the future) all use this
  frecklet as their base.

Options:
  --product-name PRODUCT_NAME  The name of the product.  [required]
  --version VERSION            The version of the product.  [required]
  --dest DEST                  The (absolute) path to the parent folder of the
                               downloaded executable file.
  --exe-mode EXE_MODE          The mode for the executable file(s) (default:
                               '0755').
  --group GROUP                The group of the executable.
  --owner USER                 The owner of the executable.
  --help                       Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.hashicorp_executable_installed.HashicorpExecutableInstalled
#


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

@dataclass
class HashicorpExecutableInstalled(AutoPycklet):
    """A utility frecklet to help install Hashicorp products.

     Hashicorp tools (Packer, Terraform, Consul, ...) are built and hosted in a similar fashion, which is why it's
     convenient to have a wrapper frecklet like this. The 'terraform-installed', 'consul-installed', 'packer-installed' frecklets (and possibly others in the future) all use this frecklet as their base.

       Args:
         dest: The (absolute) path to the parent folder of the downloaded executable file.
         exe_mode: The mode for the executable file(s) (default: '0755').
         group: The group of the executable.
         owner: The owner of the executable.
         product_name: The name of the product.
         version: The version of the product.

    """

    FRECKLET_ID = "hashicorp-executable-installed"

    dest: str = None
    exe_mode: str = None
    group: str = None
    owner: str = None
    product_name: str = None
    version: str = None


    def __post_init__(self):
        super(HashicorpExecutableInstalled, self).__init__(var_names=["dest", "exe_mode", "group", "owner", "product_name", "version"])


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


#
# module path: pycklets.hashicorp_executable_installed.HashicorpExecutableInstalled
#


from pyckles import AutoPycklet

class HashicorpExecutableInstalled(AutoPycklet):
    """A utility frecklet to help install Hashicorp products.

     Hashicorp tools (Packer, Terraform, Consul, ...) are built and hosted in a similar fashion, which is why it's
     convenient to have a wrapper frecklet like this. The 'terraform-installed', 'consul-installed', 'packer-installed' frecklets (and possibly others in the future) all use this frecklet as their base.

       Args:
         dest: The (absolute) path to the parent folder of the downloaded executable file.
         exe_mode: The mode for the executable file(s) (default: '0755').
         group: The group of the executable.
         owner: The owner of the executable.
         product_name: The name of the product.
         version: The version of the product.

    """

    FRECKLET_ID = "hashicorp-executable-installed"

    def __init__(self, dest=None, exe_mode="0755", group=None, owner=None, product_name=None, version=None):

        super(HashicorpExecutableInstalled, self).__init__(var_names=["dest", "exe_mode", "group", "owner", "product_name", "version"])
        self._dest = dest
        self._exe_mode = exe_mode
        self._group = group
        self._owner = owner
        self._product_name = product_name
        self._version = version

    @property
    def dest(self):
        return self._dest

    @dest.setter
    def dest(self, dest):
        self._dest = dest

    @property
    def exe_mode(self):
        return self._exe_mode

    @exe_mode.setter
    def exe_mode(self, exe_mode):
        self._exe_mode = exe_mode

    @property
    def group(self):
        return self._group

    @group.setter
    def group(self, group):
        self._group = group

    @property
    def owner(self):
        return self._owner

    @owner.setter
    def owner(self, owner):
        self._owner = owner

    @property
    def product_name(self):
        return self._product_name

    @product_name.setter
    def product_name(self, product_name):
        self._product_name = product_name

    @property
    def version(self):
        return self._version

    @version.setter
    def version(self, version):
        self._version = version



frecklet_class = HashicorpExecutableInstalled