conda-pkg-mgr

Example:

# install conda package manager
- conda-pkg-mgr

Description

Install the conda package manager.

No root permissions are required for this as long as the bzip2 system package is available.

If you specify a different 'user', it's currently not possible to add conda init code to that users '.profile'. You need to manually set 'no_add_to_path' to true to not get an error

Resources

Variables

Name Type Default Description

init_files

list ['{{ ansible_env.HOME }}/.profile']

Files to add a 'PATH=...' directive to.

no_add_to_path

boolean False

Don't add conda to PATH in init files.

user

string --

The user to install conda for.

Examples

Example 1

install conda package manager

Code
- conda-pkg-mgr

Example 2

install conda package manager withoug adding it to PATH

Code
- conda-pkg-mgr:
    no_add_to_path: true

Example 3

install conda package manager, add PATH to custom file

Code
- conda-pkg-mgr:
    init_files:
    - '{{ ansible_env.HOME }}/.init.sh'
Description

This adds the short bash snippet that adds 'conda' to the PATH env variable to the file $HOME/.init.sh instead of $HOME/.profile.

Example 4

install conda package manager for user 'freckles'

Code
- conda-pkg-mgr:
    user: freckles
    no_add_to_path: true
Description

This creates the user 'freckles' if it doesn't already exist, then installs conda for that user. Be aware, adding conda init code to the users '.profile' is currently not possible, so you have to manually set 'no_add_to_path' to true to not get an error.

Code

doc:
  short_help: Install the 'conda' package manager
  help: |
    Install the conda package manager.

    No root permissions are required for this as long as the ``bzip2`` system package is available.

    If you specify a different 'user', it's currently not possible to add conda init code to that users
    '.profile'. You need to manually set 'no_add_to_path' to true to not get an error
  references:
    Conda homepage: https://conda.io
  examples:
  - title: install conda package manager
  - title: install conda package manager withoug adding it to PATH
    vars:
      no_add_to_path: true
  - title: install conda package manager, add PATH to custom file
    desc: |
      This adds the short bash snippet that adds 'conda' to the PATH env variable to the file ``$HOME/.init.sh`` instead of ``$HOME/.profile``.
    vars:
      init_files:
      - '{{ ansible_env.HOME }}/.init.sh'
  - title: install conda package manager for user 'freckles'
    desc: |
      This creates the user 'freckles' if it doesn't already exist, then installs conda for that user. Be aware, adding conda init code to the users '.profile' is currently not possible, so you have to manually set 'no_add_to_path' to true to not get an error.
    vars:
      user: freckles
      no_add_to_path: true

args:
  no_add_to_path:
    required: false
    type: boolean
    doc:
      short_help: Don't add conda to PATH in init files.
    default: false
    cli:
      is_flag: true
      param_decls:
      - --no-add-to-path
  init_files:
    type: list
    schema: {type: string}
    required: false
    empty: true
    default:
    - '{{ ansible_env.HOME }}/.profile'
    doc:
      short_help: Files to add a 'PATH=...' directive to.
    cli:
      metavar: PATH
      param_decls:
      - --init-file
  user:
    doc:
      short_help: The user to install conda for.
    type: string
    required: false
meta:
  tags:
  - featured-frecklecutable
  - conda
  - package-manager
  - package-management
  - install

frecklets:
- user-exists:
    frecklet::skip: '{{:: user | true_if_empty ::}}'
    name: '{{:: user ::}}'
- frecklet:
    name: freckfrackery.install-conda
    type: ansible-role
    resources:
      ansible-role:
      - freckfrackery.install-conda
    desc:
      short: installing the conda package manager
      long: |
        Install the [conda](https://conda.io) package manager.
      references:
        "'freckfrackery.install-conda' Ansible role": https://gitlab.com/freckfrackery/freckfrackery.install-conda
    properties:
      idempotent: true
      elevated: '{{:: user | false_if_empty ::}}'
      internet: true
  task:
    become: '{{:: user | false_if_empty ::}}'
    become_user: '{{:: user ::}}'
  vars:
    conda_add_to_path: '{{:: no_add_to_path | negate ::}}'
    conda_add_path_files: '{{:: init_files ::}}'
frecklecute conda-pkg-mgr --help

Usage: frecklecute conda-pkg-mgr [OPTIONS]

  Install the conda package manager.

  No root permissions are required for this as long as the ``bzip2`` system
  package is available.

  If you specify a different 'user', it's currently not possible to add
  conda init code to that users '.profile'. You need to manually set
  'no_add_to_path' to true to not get an error

Options:
  --init-file PATH  Files to add a 'PATH=...' directive to.
  --no-add-to-path  Don't add conda to PATH in init files.
  --user USER       The user to install conda for.
  --help            Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.conda_pkg_mgr.CondaPkgMgr
#


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

@dataclass
class CondaPkgMgr(AutoPycklet):
    """Install the conda package manager.

     No root permissions are required for this as long as the ``bzip2`` system package is available.

     If you specify a different 'user', it's currently not possible to add conda init code to that users
     '.profile'. You need to manually set 'no_add_to_path' to true to not get an error

       Args:
         init_files: Files to add a 'PATH=...' directive to.
         no_add_to_path: Don't add conda to PATH in init files.
         user: The user to install conda for.

    """

    FRECKLET_ID = "conda-pkg-mgr"

    init_files: List = None
    no_add_to_path: bool = None
    user: str = None


    def __post_init__(self):
        super(CondaPkgMgr, self).__init__(var_names=["init_files", "no_add_to_path", "user"])


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


#
# module path: pycklets.conda_pkg_mgr.CondaPkgMgr
#


from pyckles import AutoPycklet

class CondaPkgMgr(AutoPycklet):
    """Install the conda package manager.

     No root permissions are required for this as long as the ``bzip2`` system package is available.

     If you specify a different 'user', it's currently not possible to add conda init code to that users
     '.profile'. You need to manually set 'no_add_to_path' to true to not get an error

       Args:
         init_files: Files to add a 'PATH=...' directive to.
         no_add_to_path: Don't add conda to PATH in init files.
         user: The user to install conda for.

    """

    FRECKLET_ID = "conda-pkg-mgr"

    def __init__(self, init_files=['{{ ansible_env.HOME }}/.profile'], no_add_to_path=None, user=None):

        super(CondaPkgMgr, self).__init__(var_names=["init_files", "no_add_to_path", "user"])
        self._init_files = init_files
        self._no_add_to_path = no_add_to_path
        self._user = user

    @property
    def init_files(self):
        return self._init_files

    @init_files.setter
    def init_files(self, init_files):
        self._init_files = init_files

    @property
    def no_add_to_path(self):
        return self._no_add_to_path

    @no_add_to_path.setter
    def no_add_to_path(self, no_add_to_path):
        self._no_add_to_path = no_add_to_path

    @property
    def user(self):
        return self._user

    @user.setter
    def user(self, user):
        self._user = user



frecklet_class = CondaPkgMgr