-
앤서블 간단한 명령어들클라우드 교육/ansible 2023. 1. 8. 21:19
목차
텍스트 파일 전송
touch test.txt ansible a1 -m copy -a "src=~/test.txt dest=~/test.txt"
명령어가 적용되고
옮겨졌다.
유저 생성
ansible <group> -m user "user=<name>" -k
유저 생성 확인하기
ansible <group> -m shell "tail -n 1 /etc/passwd" -k
유저 삭제하기
ansible <group> -m user -a "user=<name> state=absent" -k
확인하면 없어져있다.
httpd 서버 생성
ansible <group> -m yum -a "name=httpd state=present" vi index.html ansible <group> -m copy -a "src=index.html dest=/var/www/html/index.html"
서비스 시작
ansible <group> -m service -a "name=httpd state=started"
방화벽 오픈
ansible <group> -m firewalld -a "service=http zone=public permanent=yes immediate=yes state=enabled"
접속된다.
httpd 파일 변경
현재 이렇게 뜬다.
index.html파일을 수정해주고,
아래처럼 yaml파일을 변경해주고,
실행해주면,
변경되었다.
'클라우드 교육 > ansible' 카테고리의 다른 글
앤서블 roles (0) 2023.01.10 앤서블 playbook (0) 2023.01.09 앤서블 yaml 암호화 (0) 2023.01.09 앤서블 콘솔 (0) 2023.01.09 앤서블 (0) 2023.01.04