Coder Social home page Coder Social logo

strap's Introduction

Strap: Bootstrap Your Machine with One Command

strap is a simple shell command designed to do one thing:

Strap will take your machine from a starting state (for example, right after you buy it or receive it from your employer) and install and configure everything you want on your machine in a single command, in one shot. Run strap and you can rest assured that your machine will have your favorite command line tools, system defaults, gui applications, and development tools installed and ready to go.

Strap was initially created to help newly-hired software engineers get up and running and productive in minutes after they receive their machine instead of the hours or days it usually takes. But Strap isn't limited to software engineering needs - anyone can use Strap to install what they want - graphics software, office suites, web browsers, whatever.

Overview

At the highest level:

strap is a shell command that does the bare minimum necessary to ensure Ansible is available and then immediately runs ansible to setup (aka 'converge') the local machine.

In this sense, we're not reinventing the wheel - there are plenty of machine convergence tools out there already, and it's best to just use one of them, like Ansible.

The only difference with strap is that strap covers the 'last mile' to obtain Ansible in a generic way that:

  1. Ensures anyone can run it without knowing what Ansible is
  2. Doesn't interfere with system or user-specific Ansible installations if there are any.
  3. Ensures that the fastest way to remove it is to just delete the ~/.strap directory.

As soon as Ansible is available, strap immediately delegates to it, automatically running one or more Ansible playbooks or roles on the local machine.

And we think that's pretty great - installing Ansible or Python is not always a trivial exercise, and we wanted to ensure things 'just work', even if someone has never even heard of Python or Ansible. It's so easy to use, anyone can use it - from setting up a machine, or just installing things for a particular project, etc.

Installation

To install strap, run the following on the command line:

curl -fsSL https://raw.githubusercontent.com/strapsh/strap/master/install | bash
source "$HOME/.strap/releases/current/etc/straprc"

Usage

Strap is a command line tool. Assuming the strap installation's bin directory is in your $PATH as shown in the installation instructions above, you can just type strap --help and see what happens:

me@myhost:~$ strap --help
strap version 0.3.6
usage: strap [options...] <command> [command_options...]
 
commands:
   help        Display help for a command
   run         Runs strap to ensure your machine is configured
   version     Display the version of strap
 
See `strap help <command>' for information on a specific command.
For full documentation, see: https://github.com/strapsh/strap

The strap command itself is quite simple - it basically loads some common environment settings and that's pretty much it. From there, it delegates most functionality to sub-commands, very similar to how the git command-line tool works.

Strap Run

strap run ensures ansible is available and then immediately runs ansible to converge the local machine to a desired state.

This means that, even though one or more people can use run strap without knowing anything about ansible (a great benefit to teams), at least one person needs to know how to write ansible "packages" that will be used during a strap run. These "packages" in ansible's terminology are called playbooks and roles.

Once a playbook or role is identified or available locally, strap makes running them that much easier. You can run ansible playbooks and roles based on the directory where strap is run or by explicitly referencing them by id.

Working Directory

If you just type strap run (without any arguments) in a working directory, and that directory has an ansible playbook available via the relative path:

.strap/ansible/playbooks/default/main.yml

then strap will run that playbook automatically.

It does the following steps in order:

  1. If a .strap/ansible/playbooks/default/meta/requirements.yml file exists that lists the playbook's role dependencies, those requirements will be automatically downloaded first using the ansible-galaxy command.

    Strap enhancement: Strap has a really nice feature that enables transitive role dependency downloads: if a dependency role is downloaded, and that role in turn has a meta/requirements.yml file, Strap will automatically transitively download those dependencies that don't yet exist. It will continue to walk the dependency tree, downloading dependencies as necessary until all dependencies are resolved.

    Core ansible does not provide transitive resolution, but Strap does.

  2. Strap will call the ansible-playbook command with the discovered playbook file targeting localhost/127.0.0.1.

Specific Roles or Playbooks

If the working directory does not have a .strap/ansible/playbooks/default/main.yml playbook file, then you must specify one or more roles or playbooks using the --playbook or --role arguments, i.e.

strap run [--playbook|--role] <id>

where <id> is an Ansible Galaxy identifier (i.e. username.rolename) or a GitHub url fragment that identifies the role or playbook's git repository, (i.e. username/repo).

For example:

strap run --role geerlinguy.java

or

strap run --playbook example/foo

strap's People

Contributors

lhazlewood avatar songtingxu-okta avatar seanwang-okta avatar kelvinzhu-okta avatar brianhuang-okta avatar deekue avatar jerryfu-okta 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.