본문 바로가기

반응형

Ansible

Ansible 인벤토리를 YAML 파일로 설정하는 방법 Ansible 인벤토리를 YAML 파일로 설정하는 방법 YAML 파일을 사용하여 호스트 그룹 및 호스트에 대한 정보를 정의할 수 있습니다. 기본적인 YAML 형식의 Ansible 인벤토리 예제 Ansible 인벤토리 파일 편집 vim hosts.yml --- all: # all 그룹 정의 hosts: webserver: ansible_host: 192.168.1.10 ansible_user: ubuntu ansible_ssh_private_key_file: /path/to/private_key.pem database: ansible_host: 192.168.1.11 ansible_user: centos ansible_password: your_password webservers: # webservers .. 더보기
Ansible 구성 설정(Configuration Settings) 파일의 우선 순위에 대한 설명 Ansible 구성 설정(Configuration Settings) 파일의 우선 순위에 대한 설명 구성 설정 파일(ansible.cfg)의 우선 순위 1. 환경 변수 (Environment Variables) Ansible은 ANSIBLE_CONFIG 환경 변수를 통해 구성 파일의 경로를 지정할 수 있습니다. 이 환경 변수가 설정되어 있으면 해당 경로의 구성 파일이 사용됩니다. export ANSIBLE_CONFIG=/path/to/your/ansible.cfg 2. 커맨드 라인 인수 (Command Line Arguments) ansible-playbook이나 ansible 명령을 실행할 때 -i나 -e와 같은 인수를 사용하여 구성을 지정할 수 있습니다. 이는 명령이 실행되는 동안 구성을 임시로 설정하.. 더보기
[리눅스] ansible user 모듈(user module) ansible user 모듈(user module) 불필요한 계정 삭제하기 userDelete.yaml 파일 작성 cat (item=lp) ok: [kube-node1] => (item=lp) changed: [kube-node3] => (item=lp) changed: [kube-node5] => (item=lp) ok: [kube-node1] => (item=news) changed: [kube-node2] => (item=news) changed: [kube-node4] => (item=lp) changed: [kube-node3] => (item=news) ok: [kube-node1] => (item=uucp) changed: [kube-node2] => (item=uucp) changed: [.. 더보기
[리눅스] 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 |.. 더보기
[URL] Ansible Documentation URL Ansible Documentation URL https://docs.ansible.com/ansible/latest/getting_started/index.html Getting started with Ansible — Ansible Documentation © Copyright Ansible project contributors. Last updated on Aug 19, 2022. docs.ansible.com 더보기
[Ansible] macOS에 ansible 설치 macOS에 ansible 설치 테스트 환경 system_profiler SPSoftwareDataType | egrep 'System Version' $ system_profiler SPSoftwareDataType | egrep 'System Version' System Version: macOS 12.5 (21G72) ansible 설치(brew install) ansible search brew search ansible $ brew search ansible ==> Formulae ansible ansible-cmdb ansible-language-server ansible-lint [email protected] [email protected] ==> Casks ansible-dk ansible informatio.. 더보기
ansible inventory(인벤토리) 설정 Ansible inventory 설정 Ansible은 인벤토리로 알려진 목록 또는 목록 그룹을 사용하여 인프라의 여러 관리 노드 또는 "호스트"에 대해 동시에 작동합니다. 인벤토리가 정의되면 패턴을 사용하여 Ansible을 실행할 호스트 또는 그룹을 선택합니다.(대상 서버 리스트) 구성 설정(Configuration settings) ANSIBLE_CONFIG (환경 변수에 지정한 경우) ansible.cfg (현재 디렉토리) ~/.ansible.cfg (홈 디렉토리) /etc/ansible/ansible.cfg (기본) vim ~/.ansible.cfg cat ~/.ansible.cfg [defaults] inventory = ~/inventory/hosts.ini host_key_checking = .. 더보기
[Ansible] shell, command, yum, user 모듈 Ansible shell, command, yum, user 모듈 Ansible에서 모듈 사용법 shell 모듈 $ ansible db1 -m shell -a "free -h" db1 | CHANGED | rc=0 >> total used free shared buff/cache available Mem: 3.8G 162M 2.7G 540K 997M 3.4G Swap: 0B 0B 0B command 모듈 $ ansible db1 -m command -a "cat /etc/passwd" db1 | CHANGED | rc=0 >> root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin ... ec2-user:x:1000:1000:EC2 Defaul.. 더보기

728x90
반응형