Skip to content

Instantly share code, notes, and snippets.

@jkirk
Created November 23, 2021 20:05
Show Gist options
  • Save jkirk/6ccd7173d9aea0e43e661ed96ede62bf to your computer and use it in GitHub Desktop.
Save jkirk/6ccd7173d9aea0e43e661ed96ede62bf to your computer and use it in GitHub Desktop.
ARA Records Ansible Functions

ARA Records Ansible Functions

.zshrc.local:

# ansible ara functions
function ara_playbooks() { ara playbook list --limit ${1:=10} }
function ara_playbooks_checkrun() { ara playbook list --label "check:True" --limit ${1:=10} }
function ara_playbooks_fullrun() { ara playbook list --label "check:True" --limit ${1:=10} }
function ara_last() { ara playbook list --limit 1 -c id -f value }
function ara_hosts_changed() { ara result list --playbook $1 --limit 100 --resolve -c id -c host --changed }
function ara_hosts_failed() { ara result list --playbook $1 --limit 100 --resolve -c id -c host --status failed }
function ara_tasks_changed() { ara result list --playbook $1 --resolve --changed --status ok -c id -c task -c host }
function ara_tasks_failed() { ara result list --playbook $1 --limit 100 --resolve --status failed -c id -c task -c host }
function ara_task_diff() { TASK_ID=$1; diff -u <(ara result show $TASK_ID -f json --with-content | jq ".content.diff[].before" -r) <(ara result show $TASK_ID -f json --with-content | jq ".content.diff[].after" -r) }
function ara_task_contentmsg() { ara result show --with-content -f json $1 | jq .content.msg }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment