Skip to content

Latest commit

 

History

History

opsx

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Enrich Operations CLI tools with environment and package data

opsx

A simple command line tool to parse .env and package.json files into environment variables that appends commonly used operational tools arguments.

Bash

Collected variables can be substituted in package.json scripts, for example:

opsx docker build -t your/image:^PKG_VERSION^ .

Docker

Build arguments are passed from BUILD_<attr>=<value> and PKG_<attr> environment variables, for example:

export PKG_VERSION="1.2.3" # done automatically
export BUILD_SOMETHING="example"
opsx docker build -t your/image:tag .
> docker build -t your/image:tag --build-arg PKG_VERSION=1.2.3 --build-arg SOMETHING=example .

Terraform

Backend configuration can be now set by TF_BACKEND_<attr>=<value> environment variables, for example:

export TF_BACKEND_USERNAME="adaliszk"
opsx terraform init
> terraform init -backend-config=username=adaliszk

Ansible

Hosts can be passed via the ANSIBLE_HOSTS environment variable, for example:

export ANSIBLE_HOSTS="127.0.0.1"
opsx ansible-playbook my-automation.yml
> ansible-playbook my-automation.yml -i 127.0.0.1,