diff options
Diffstat (limited to 'Completion/Unix/Command/_ansible')
| -rw-r--r-- | Completion/Unix/Command/_ansible | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible index ab0cdee6c..d87bf49c2 100644 --- a/Completion/Unix/Command/_ansible +++ b/Completion/Unix/Command/_ansible @@ -50,11 +50,12 @@ case $service in args+=( '(-J --ask-vault-pass --ask-vault-password)'{-J,--ask-vault-pass{,word}}'[ask for vault password]' \*{-e+,--extra-vars=}'[set additional variables]:key=value, YAML/JSON or @file:->extra-vars' + '--flush-cache[clear fact cache for every host in inventory]' '*--vault-id=[specify vault identity to use]:vault identity' --vault-pass{,word}-file='[specify vault password file]:vault password file:_files' \*{-i+,--inventory=}'[specify inventory host file or host list]: : _alternative "files\:inventory file\:_files" "hosts\:host\: _sequence _hosts"' - '!(-i --inventory)--inventory-file=:inventory file:_files' + '!*--inventory-file=:inventory file:_files' '(-l --limit --host --graph)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts' ) ;| @@ -65,8 +66,8 @@ case $service in ;| ansible-playbook|ansible-pull) args+=( - \*{-t,--tags}'[only run plays and tasks tagged with these values]:tag:->tags' - "*--skip-tags[only run plays and tasks whose tags don't match]" + \*{-t,--tags=}'[only run plays and tasks tagged with these values]:tag:->tags' + "*--skip-tags=[only run plays and tasks whose tags don't match]:tag:->tags" ) ;| ansible-playbook|ansible-console) @@ -142,7 +143,6 @@ case $service in ;; ansible-playbook) args+=( - '--flush-cache[clear the fact cache for every host in inventory]' '--force-handlers[run handlers even if a task fails]' '--list-tags[list all available tags]' '--list-tasks[list all tasks that would be executed]' @@ -207,10 +207,15 @@ case $state in else local -a inventory typeset -ga _ansible_hosts _ansible_groups + typeset -g _ansible_inventory_last_cwd + if [[ $PWD != $_ansible_inventory_last_cwd ]]; then + unset _ansible_hosts _ansible_groups + fi if (( !$#_ansible_hosts || !$#_ansible_groups )); then inventory=( ${(f)"$(_call_program groups ansible-inventory --graph)"} ) _ansible_hosts=( ${${(M)inventory%--[^:]#}#--} ) _ansible_groups=( ${${${(M)inventory%@*:}%:}#@} ) + _ansible_inventory_last_cwd=$PWD fi if [[ $state = hosts ]]; then suf=( -qS: ) |
