Update debops aliases

This commit is contained in:
gardouille 2022-03-24 10:21:56 +01:00
parent 1e7cbf3a87
commit b23a2edbde
Signed by: gardouille
GPG Key ID: E759BAA22501AF32
1 changed files with 92 additions and 14 deletions

106
zshrc
View File

@ -978,28 +978,106 @@ function timove() {
# }}}
# DebOps {{{
## Direct access to DebOps's roles directory
hash -d dero="${HOME}/.local/share/debops/debops/ansible/roles/"
## Source DebOps user environment file {{{
if [ -f "${HOME}/.config/debops/environment" ]; then
source "${HOME}/.config/debops/environment"
fi
## }}}
## Direct access to DebOps's directories
alias dero="cd ${DEBOPS_VENV_ROLES:-/dev/null}"
alias deplay="cd ${DEBOPS_VENV_PLAYBOOKS:-/dev/null}"
## Apply all config to all hosts except the new cluster nodes
alias deal="debops -l 'debops_all_hosts:!physix'"
## Apply only on new cluster nodes
alias decc="debops -l 'physix'"
## Limit to a define host/group
function deho() {
## Apply full config to a define host(s)/group(s) {{{
function debhost() {
if [ ${ANS_HOST} ]; then
debops -l "${ANS_HOST}"
debops run site --limit "${ANS_HOST}"
else
printf '%b' "${MAGENTA}ANS_HOST${RESET} vars is ${REDB}not${RESET} define!\n"
fi
}
## Limit to a define host/group and to a role
function dero() {
debops -l "${ANS_HOST}" -t role::"${1}"
## }}}
## Apply a role to a define host(s)/group(s) {{{
function debrole() {
if [ ${ANS_HOST} ]; then
debops run site --limit "${ANS_HOST}" --tags "role::${1:-/dev/null}"
else
printf '%b' "${MAGENTA}ANS_HOST${RESET} vars is ${REDB}not${RESET} define!\n"
fi
}
## }}}
## Apply the role from a service to a define host(s)/group(s) {{{
function debserv() {
if [ ${ANS_HOST} ]; then
debops run service/"${1:-/dev/null}" --limit "${ANS_HOST}" --tags "role::${1:-/dev/null}"
else
printf '%b' "${MAGENTA}ANS_HOST${RESET} vars is ${REDB}not${RESET} define!\n"
fi
}
## }}}
## Apply a role from a service to a define host(s)/group(s) {{{
function debservice() {
if [ ${ANS_HOST} ]; then
debops run service/"${1:-/dev/null}" --limit "${ANS_HOST}"
else
printf '%b' "${MAGENTA}ANS_HOST${RESET} vars is ${REDB}not${RESET} define!\n"
fi
}
## }}}
## Apply a playbook to a define host(s)/group(s) {{{
function debplay() {
if [ ${ANS_HOST} ]; then
debops run "${1:-/dev/null}" --limit "${ANS_HOST}"
else
printf '%b' "${MAGENTA}ANS_HOST${RESET} vars is ${REDB}not${RESET} define!\n"
fi
}
## }}}
## Check full config to a define host(s)/group(s) {{{
function debchost() {
if [ ${ANS_HOST} ]; then
debops check site --limit "${ANS_HOST}"
else
printf '%b' "${MAGENTA}ANS_HOST${RESET} vars is ${REDB}not${RESET} define!\n"
fi
}
## }}}
## Check a role to a define host(s)/group(s) {{{
function debcrole() {
if [ ${ANS_HOST} ]; then
debops check site --limit "${ANS_HOST}" --tags "role::${1:-/dev/null}"
else
printf '%b' "${MAGENTA}ANS_HOST${RESET} vars is ${REDB}not${RESET} define!\n"
fi
}
## }}}
## Check the role from a service to a define host(s)/group(s) {{{
function debcserv() {
if [ ${ANS_HOST} ]; then
debops check service/"${1:-/dev/null}" --limit "${ANS_HOST}" --tags "role::${1:-/dev/null}"
else
printf '%b' "${MAGENTA}ANS_HOST${RESET} vars is ${REDB}not${RESET} define!\n"
fi
}
## }}}
## Check a role from a service to a define host(s)/group(s) {{{
function debcservice() {
if [ ${ANS_HOST} ]; then
debops check service/"${1:-/dev/null}" --limit "${ANS_HOST}"
else
printf '%b' "${MAGENTA}ANS_HOST${RESET} vars is ${REDB}not${RESET} define!\n"
fi
}
## }}}
## Check a playbook to a define host(s)/group(s) {{{
function debcplay() {
if [ ${ANS_HOST} ]; then
debops check "${1:-/dev/null}" --limit "${ANS_HOST}"
else
printf '%b' "${MAGENTA}ANS_HOST${RESET} vars is ${REDB}not${RESET} define!\n"
fi
}
## }}}
# }}}
# Web apps {{{
# Get weather