Skip to content

Instantly share code, notes, and snippets.

@yanick
Created March 25, 2021 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanick/744312c7503a31f249d3549e3e91a560 to your computer and use it in GitHub Desktop.
Save yanick/744312c7503a31f249d3549e3e91a560 to your computer and use it in GitHub Desktop.
#!/usr/bin/env fish
# always wanted Ansible to be --check by default.
# Well, through the magic of arg munging, it can be!
# add `--check --diff` to all commands, unless it ends
# with GO
# E.g.,
# ansiplay playbooks/foo.yml # --check and --diff added
# ansiplay playbooks/foo.yml GO # GO removed and playbook ran fo' realz
# also added `!@` as a shortcut for --skip-tags. Because lazy.
set argv ( echo $argv | perl -pe 's/\@!/--skip-tags /' )
set argv ( echo $argv | perl -pe 's/GO// or s/$/ --check --diff/' )
eval ansible-playbook $argv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment