Provide a bash completion on host name, module name and options for ansible.
-
Get the
ansible-completion.bash
file. -
Copy/move the
ansible-completion.bash
in yourbash_completion.d
folder (/etc/bash_completion.d
,/usr/local/etc/bash_completion.d
or~/bash_completion.d
). -
Or copy/move it where you want and then load the
ansible-completion.bash
file in your~/.bashrc
or~/.profile
like that:source ~/ansible-completion.bash
-
Reload your shell with something like
source ~/.bashrc
orsource ~/.profile
If the --module-path
(-M
) or --inventory-file
(-i
) is on the command line, the completion will use it.
For the completion on module name, the completion script build a cache of modules names.
You can set the cache timeout with the environement variable ANSIBLE_COMPLETION_CACHE_TIMEOUT
, the default value is 120
secondes.