본문 바로가기
DevOps/Ansible

Ansible 기본

by ssyeon 2022. 4. 21.

 

/etc/ansible/ansible.cfg - 환경 설정 파일

/etc/ansible/hosts - 앤서블이 접속하는 호스트들에 대한 정보

 

 

 

-i  적용될 호스트들에 대한 파일
-m 모듈을 선택할 수 있음
-k 패스워드를 물어보도록 설정
-K 관리자로 권한 상승
--list-hosts 적용되는 호스트들을 확인

 

 

 


 

uptime 확인하기

ansible all -m shell -a "uptime" -k

 

 

 

 

디스크 용량 확인하기

ansible all -m shell -a "df -h"

 

 

 

 

 

메모리 확인하기

ansible all -m shell -a "free -h" -k

 

 

 

 

 

 

user 만들기

ansible all -m user -a "name=testgroup password=1234" -k

 

 

user잘 만들어졌는지 확인하기

 

 

 

 

 

반응형

댓글