GithubHelp home page GithubHelp logo

classicvalues / ansible-role-pkg-mgr-path Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ableton/ansible-role-pkg-mgr-path

1.0 1.0 0.0 54 KB

An Ansible role to set variables based on the system package manager's paths

License: MIT License

Jinja 28.68% Python 71.32%

ansible-role-pkg-mgr-path's Introduction

Ansible role ableton.pkg_mgr_path

This role sets variables for non-standard paths that belong to an Ansible host's package manager. The primary use-case is for provisioning on macOS-based hosts where the Homebrew and MacPorts package managers aren't able to install their packages to a location which is part of the default system PATH.

When this role finishes, it will set data in facts which can then be used to set the path for other tasks. Please see the "Role Variables" and "Example Playbook" sections below.

Requirements

Ansible >= 2.10 is required. The following host OS types are supported:

  • Debian Linux
  • macOS (for both Homebrew and MacPorts)
  • Windows (Chocolatey)

On Linux, apt can install packages to the system PATH, and on Windows the concept of paths (especially with Ansible) is somewhat different, however this role supports those OS types in the interest of being cross-platform. The intention is that role should be easy to add as a dependency of another role regardless of the OS type.

Role Variables

This role has no required variables, but when it finishes running, it will set these variables for you:

  • ansible_pkg_mgr_bin: The location to the package manager's binary folder (for example, /opt/whatever/bin).
  • ansible_pkg_mgr_path: The full system path with the package manager's binary folder first (for example, /opt/whatever/bin:/usr/bin:/bin:/usr/sbin:/sbin).
  • ansible_pkg_mgr_prefix: The prefix to the package manager's installation folder (for example, /opt/whatever).

IMPORTANT: While this role has no required variables, it does require that the ansible_pkg_mgr variable has been set. This is usually set when gathering facts for a host, but can also be set manually, or by calling the gather_facts module.

Example Playbook

---
- name: Run a command which has been installed by a package manager
  hosts: "all"

  roles:
    - ableton.pkg_mgr_path

  tasks:
    - name: Run a command by setting the PATH for this task
      command: cowsay hello
      environment:
        PATH: "{{ ansible_pkg_mgr_path }}"

    - name: Run a command with the absolute path
      command: "{{ ansible_pkg_mgr_bin }}/cowsay hello"

License

MIT

Maintainers

This project is maintained by the following GitHub users:

ansible-role-pkg-mgr-path's People

Contributors

nre-ableton avatar dependabot[bot] avatar mst-ableton avatar rco-ableton avatar

Stargazers

Classic Values avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.