Coder Social home page Coder Social logo

pantsible's Introduction

pantsible

Ansible with an embedded Python Interpreter... Also, this project uses Pants...

Why?

To solve a mildly annoying chicken and egg problem.

When I provision a Mac, I want to use my Ansible playbooks to do it. So I need to install Ansible, but to install Ansible, I need to have pipx installed. To install pipx I need to have homebrew installed.

But I want my Ansible playbook to install homebrew for me.

I could just use the system Python interpreter (which is usually years out of date) to install Ansible to the global site-packages, but I never do that:

export PIP_REQUIRE_VIRTUALENV=true

So, I guess I could create a temp venv, activate it, install Ansible, run my playbook, delete the venv, and then re-install Ansible using either pipx or homebrew.

...

OR, I could take 20 minutes to create this project which bundles Ansible with a Python interpreter - and then curl it down to my Mac and run it.

How to Upgrade Ansible

Update the requirements.txt with the version of interest.

How to Build

  • Install Pants
  • pants package :pantsible

How to Run

Whether you build the binary it locally, or download it from Releases - you should probably put the binary in a directory on your PATH (e.g. /usr/local/bin, ~/.local/bin, etc) and maybe re-name it if you're so inclined.

Since the Ansible CLI is built up of subcommands (each command is a small Python shim calling the appropriate module), you can't just use the pantsible command other than to use ad-hoc mode.

SCIEs have a built-in mechanism to support multiple commands and that is leveraged here, along with the alias script, to replicate the Ansible CLI. Source the alias script (or add it to your shell profile, or use the long-form command) and you can use ansible, ansible-playbook, ansible-vault, etc.

SCIE_BOOT=vault pantsible encrypt <file>

# after sourcing the alias file

ansible-vault encrypt <file>

pantsible's People

Contributors

sureshjoshi 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.