본문 바로가기

리눅스

Ansible을 위한 기본 Bash 완성을 설치하는 방법

728x90

Ansible을 위한 기본 Bash 완성을 설치하는 방법(Basic bash completion for Ansible)

  • github 다운로드
git clone https://github.com/dysosmus/ansible-completion.git
$ ls -l ansible-completion
total 68
-rw-rw-r-- 1 vagrant vagrant  5835 Nov  7 14:01 ansible-completion.bash
-rw-rw-r-- 1 vagrant vagrant   334 Nov  7 14:01 ansible-doc-completion.bash
-rw-rw-r-- 1 vagrant vagrant  1072 Nov  7 14:01 ansible-galaxy-completion.bash
-rw-rw-r-- 1 vagrant vagrant  1165 Nov  7 14:01 ansible-playbook-completion.bash
-rw-rw-r-- 1 vagrant vagrant   595 Nov  7 14:01 ansible-pull-completion.bash
-rw-rw-r-- 1 vagrant vagrant   685 Nov  7 14:01 ansible-vault-completion.bash
-rw-rw-r-- 1 vagrant vagrant 35120 Nov  7 14:01 LICENSE
-rw-rw-r-- 1 vagrant vagrant  2526 Nov  7 14:01 README.md
  • ansible 명령 자동완성
sudo cp ansible-completion/ansible-completion.bash /etc/bash_completion.d/
  • ansible-playbook 명령 자동 완성
sudo cp ansible-completion/ansible-playbook-completion.bash /etc/bash_completion.d/.
  • ansible-doc 명령 자동 완성
sudo cp ansible-completion/ansible-doc-completion.bash /etc/bash_completion.d/.
source ~/.bashrc
  • ansible 명령 입력 후 Tab,Tab
$ ansible -i ./inventory --

a1

  • ansible-playbook 명령 입력 후 Tab,Tab
$ ansible-playbook -i ./inventory --

a2

 

참고URL

- Ansible 명령 셸 완성 추가 : https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#adding-ansible-command-shell-completion

 

728x90