Ansible
Ansible(uptime,disk,mem,user, file)
삽수
2023. 7. 28. 11:20
반응형
[ uptime 확인 ]
ansible nginx -m shell -a "uptime" -k
=> 명령어 풀이 : nginx 그룹을 호스트로 사용하며, shell이라는 모듈을 통해서 uptime 을 실행한다.
[ disk 확인 ]
ansible nginx -m shell -a "df -lh" -k
=> 명령어 풀이 : nginx 그룹을 호스트로 사용하며, shell이라는 모듈을 통해서 df -lh 을 실행한다.
[ 메모리 확인 ]
ansible nginx -m shell -a "free -mh" -k
[ 유저 생성 ]
ansible nginx -m user -a "name=test password=1" -k
=> 명령어 풀이 : nginx 그룹을 호스트로 사용하며, user 이라는 모듈을 통해서 name=test, passwd=1이라는 유저를 생성해준다. !여기서는 유저가 생성은 되었지만 암호화가 되지 않아 실행이 불가능하다.
cat /etc/passwd 를 통해서 확인
cat /etc/passwd
[ 파일 전송 ]
ansible ninx -m copy -a "src=./test.file dest=/tmp/" -k
=> 명령어 풀이 : nginx 그룹을 호스트로 사용하며, copy 라는 모듈을 통해서 src 소스 파일 위치 , dest = 도착지 를 설정후에 실행해준다.
확인
[ httpd 설치 ]
ansible nginx -m yum -a "name=httpd state=present" -k
반응형