/dploy

A meta CLI for Ansible which enable multi inventory deployment while providing smart completion

Primary LanguageGoMIT LicenseMIT

dploy

test Coverage Status GitHub go.mod Go version Go Report Card dowload

dploy is a meta CLI for Ansible which enable multi inventory deployment while providing smart completion.

It supports ansible-playbook and ansible command

Intallation

curl -ssf -L https://raw.githubusercontent.com/ca-gip/dploy/master/install.sh | bash

Adding completion for bash (also available for zsh and fish)

echo "source <(dploy completion bash)" >> ~/.bashrc

Usage

dploy -h
Ansible deployment toolbox

Usage:
  dploy [command]

Available Commands:
  completion  Generate completion script
  exec        Run Ad Hoc command
  generate    Generate ansible-playbook command
  help        Help about any command
  play        Run ansible-playbook command

How to select inventories ?

All subcommand use a --filter arguments that will select inventories based on the vars declared under [all:vars] in *.ini files.

Filter implement the following operators to match variable value:

  • Equal ==
  • NotEqual !=
  • EndWith $=
  • Contains ~=
  • StartWith ^=

Filtering is based on the location where the command is executed as it will recursively search all *.ini files.

Subcommands

Play

Launch a playbook

dploy play --filter platform==os -p upgrade-proxy.yml

Completion is available for :

  • --playbook only yaml files that are valid playbooks will be shown
  • --tags a playbook must selected beforehand

Exec

Execute Ad Hoc command

dploy exec --filter customer==os -m ping -p lb

Completion is available for :

  • --pattern it will list all groups and host present in inventories files

Developed with
drawing