본문 바로가기

728x90

ansible

[리눅스] Ansible을 위한 기본 bash 완성 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-- .. 더보기
[Ansible] inventory(인벤토리) YAML 설정 - 2 inventory(인벤토리) YAML 설정 - 2 디렉터리 구조 level 1 level 2 level 3 level 4 비고 inventory inventory.yaml --- --- --- --- group_vars hosts.yaml --- --- --- --- blog hosts.yaml b-db hosts.yaml b-web hosts.yaml --- --- --- --- site-a hosts.yaml development hosts.yaml stage hosts.yaml production hosts.yaml 인벤토리 확인 ansible-inventory -i ~/ansible-spec/inventory --graph $ ansible-inventory -i ~/ansible-spec/inv.. 더보기
[Ansible] 구성 설정(Configuration Settings) Ansible 구성 설정(Configuration Settings) 구성 파일(ansible.cfg) 우선 순위 1. ANSIBLE_CONFIG 환경 변수 2. 현재 디렉토리의 ansible.cfg 3. 홈 디렉토리의 .ansible.cfg(~/.ansible.cfg) 4. /etc/ansible/ansible.cfg ansible version 명령으로 현재 적용되고 있는 구성 파일(ansible.cfg)을 확인할 수 있음 ansible --version $ ansible --version ansible 2.9.27 config file = /home/tuser/ansible-spec/ansible.cfg configured module search path = [u'/home/tuser/.ansibl.. 더보기
[리눅스] ansible apt 모듈(apt module) ansible apt 모듈(apt module) 인벤토리(inventory) 확인 ansible-inventory -i inventory/mycluster/inventory.ini --graph $ ansible-inventory -i inventory/mycluster/inventory.ini --graph @all: |--@etcd: | |--kube-control1 |--@k8s_cluster: | |--@calico_rr: | |--@kube_control_plane: | | |--kube-control1 | |--@kube_node: | | |--kube-node1 | | |--kube-node2 | | |--kube-node3 | | |--kube-node4 | | |--kube-node5 |.. 더보기
[iac][ansible] 동적 인벤토리(aws_es2 plugin) 앤서블 동적 인벤토리(aws_es2 plugin) aws ec2 동적 인벤토리 플러그인 설치 Requirements - pthon >= 3.6 - boto3 >= 1.16.0 - botocore >= 1.19.0 sudo apt install -y python3-boto3 ansible-galaxy 명령으로 플러그인 설치 ansible-galaxy collection install amazon.aws $ ansible-galaxy collection list | grep amazon.aws amazon.aws 2.3.0 amazon.aws 4.1.0 ansible.cfg 생성 vim ansible.cfg [defaults] inventory = my_aws_ec2.yaml aws_ec2 모듈 문서 확인 .. 더보기
[iac][ansible] ansible-config 명령 ansible-config 명령 ansible-config -h $ ansible-config -h usage: ansible-config [-h] [--version] [-v] {list,dump,view,init} ... View ansible configuration. positional arguments: {list,dump,view,init} list Print all config options dump Dump configuration view View configuration file init Create initial configuration optional arguments: --version show program's version number, config file location, .. 더보기
[iac][ansible] ansible-doc 명령 ansible-doc 명령 ansible-doc -h $ ansible-doc -h usage: ansible-doc [-h] [--version] [-v] [-M MODULE_PATH] [--playbook-dir BASEDIR] [-t {become,cache,callback,cliconf,connection,httpapi,inventory,lookup,netconf,shell,vars,module,strategy,role,keyword}] [-j] [-r ROLES_PATH] [-e ENTRY_POINT | -s | -F | -l | --metadata-dump] [plugin [plugin ...]] plugin documentation tool positional arguments: plugin.. 더보기
[iac][ansible] 앤서블 인벤토리 앤서블 인벤토리 앤서블 버전 정보 ansible --version $ ansible --version ansible [core 2.12.8] config file = /etc/ansible/ansible.cfg configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3/dist-packages/ansible ansible collection location = /home/vagrant/.ansible/collections:/usr/share/ansible/collections.. 더보기