목록전체 글 (28)
ITFragile

♡ 사용모듈 mysql_user : 사용자 생성 작업 mysql_db : DB 생성 작업 mysql_query : SQL 작업 MySQL collection 설치 Ansible Galaxy ansible-galaxy collection install community.mysql ★ create user # db.yaml - name: Create User mysql mysql_user: # user 생성 모듈 name: web_user password: 12345 host: '%' priv: '*.*:ALL' state: present [db-m01 접속 확인] [db-s01 접속 확인] ★ create DB # db-m01 - name: Create User mysql mysql_user: name: ..

♡ 사용모듈 mysql_secure_installation : root 비밀번호 초기화 및 보안 강화를 위한 설정 mysql_replication : 이중화 작업 1. mysql_secure_installation 모듈 설치 https://github.com/eslam-gomaa/mysql_secure_installation_Ansible 참조하여 py 설치 mkdir ~/.ansible/plugins/modules wget https://raw.githubusercontent.com/eslam-gomaa/mysql_secure_installation_Ansible/master/library/mysql_secure_installation.py 2. mysql_secure_installation Setti..

컨트롤노드에서 작성한 index.html을 web01,02에 로드밸런싱되게 옮기려고 함 1. main 플레이북 추가 2. index.html 작성 #controlnode # vim index.html Welcome to Kyungeun's Page!!! 3. 플레이북 작성 # index.yaml - name: copy index.html template: src: index.html dest: /var/www/html - name: rewrite index.html lineinfile: # 해당 경로의 파일 내용 변경 path: /var/www/html/index.html regexp: "^Welcome" line: Welcome to Kyungeun's Page!!! {{ ansible_facts.ho..

메인 플레이북에 import_tasks 모듈로 haproxy.yaml 파일을 불러오게 작성하고, 이 haproxy를 통해 webserver 01,02를 로드밸런싱 할 수 있도록 설정한다. 1. main 플레이북 작성 [main.yaml] 2. haproxy 플레이북 작성 # haproxy.yaml - name: haproxy template setting template: # 템플릿 파일을 지정된 이름으로 원격 서버에 복사 src: haproxy.cfg.j2 # 해당 파일 필요 dest: /etc/haproxy/haproxy.cfg - name: restart haproxy service: name: haproxy state: restarted 3. haproxy.cfg.j2 작성 # vim haprox..

main Playbook에 LB, WEB, DB 모두 구분하여 작성하였으며, 공통 파일과 변수 파일을 따로 관리할 수 있도록 한다. 1. 공통 파일 # yum.yaml - name: This task is {{ pkg_name }} install yum: name: "{{ pkg_name }}" state: latest # service.yaml - name: This task is {{ svc_name }} service start service: name: "{{ svc_name }}" state: started # stopped, restarted enabled: true # false # ufw.yaml - name: This task is firewall rule setting ufw: rule..

작업환경 : virtualbox / ubuntu 20.04 / ansible 2.9.6 Server Install List webserver : apache2, php, php-mysql dbserver: mariadb LoadBalancer : haproxy Control-node Info control-node01 : 192.168.56.101 WEB Server Info web-01 : 192.168.56.102 web-02 : 192.168.56.103 DB Server Info db-m01 : 192.168.56.104 db-s02 : 192.168.56.105 LoadBalancer Info lb-01 : 192.168.56.106 vagrant ssh control-node01 1. 레포리지..