1. Ansible의 명령어 형식
2. 주로 쓰는 모듈
3. Inventory
4. 추가 옵션
[1. Ansible의 명령어 형식]
{Ad-Hoc 방식}
ansible (host) -m (module name) -a ( 모듈 옵션) [ 추가 옵션]
{Playbook 실행 방식}
ansible-playbook - i inventory.ini install_nginx.yml
[ 2. 주로 쓰는 모듈 ]
- apt, yum
: 모듈 옵션: name= nginx, state= present, latest, absent
- copy,file
: 모듈 옵션: src= CN의 path, dest = MN의 path | state = directory, touch, absent
- systemd, service
: 모듈 옵션: name= nginx state= started, restarted,stopped
- ping
- command, shell ( | > < && 사용가능)
: ex: command -a "uptime" , shell -a " echo hello && datetime"
3. Inventory
- i inventory.ini 형식으로 inventory 안의 host들을 대상으로 자동화 가능
4. 추가 옵션
-- become : sudo 권한 사용가능
-- list-hosts : 대상 host list 출력
- o : 단순 출력 형식 변경
'공부 > Ansible' 카테고리의 다른 글
25 04 10 ansible 학습 (0) | 2025.04.10 |
---|---|
5. Ansible의 playbook 형식 (0) | 2025.03.31 |
3. 에이전트리스 방식이란? (0) | 2025.03.27 |
2. Yaml 기본 문법 (0) | 2025.03.27 |
1. Ansible이란 (0) | 2025.03.25 |