yeonghoon.kim

  • 게시판
  • 갤러리
  • aws

CentOS8 npm 설치(저사양) - centos8_npm.yml

김영훈 2019.09.30 14:50 조회 수 : 4661

---
- hosts: centos8_init
  user: ioniere
  become: yes

  vars:
    db_passwd: secret

  tasks:

  - name: nginx 설치
    yum:
      name: nginx
      state: latest

  - name: mariadb 설치
    yum:
      name: ['mariadb-server', 'mariadb']
      state: latest

  - name: php 설치
    yum:
      name: ['php-bcmath', 'php-cli', 'php-common', 'php-dba', 'php-dbg', 'php-devel', 'php-embedded', 'php-enchant', 'php-fpm', 'php-gd', 'php-gmp', 'php-intl', 'php-json', 'php-ldap', 'php-mbstring', 'php-mysqlnd', 'php-odbc', 'php-opcache', 'php-pdo', 'php-pear', 'php-pecl-apcu', 'php-pecl-apcu-devel', 'php-pecl-zip', 'php-pgsql', 'php-process', 'php-recode', 'php-snmp', 'php-soap', 'php-xml', 'php-xmlrpc']
      state: latest

  - name: nginx.conf 복사
    get_url:
      url: http://data.yeonghoon.kim/centos8_npm/source/nginx.conf
      dest: /etc/nginx/nginx.conf
      force: yes

  - name: nginx fastcgi_params 복사
    get_url:
      url: http://data.yeonghoon.kim/centos8_npm/source/fastcgi_params
      dest: /etc/nginx/fastcgi_params
      force: yes

  - name: nginx virtualhost.conf_sample 복사
    get_url:
      url: http://data.yeonghoon.kim/centos8_npm/source/virtualhost_sample_conf
      dest: /etc/nginx/conf.d/virtualhost_sample_conf
      force: yes

  - name: mariadb-server.cnf(my.cnf) 복사
    get_url:
      url: http://data.yeonghoon.kim/centos8_npm/source/mariadb-server.cnf
      dest: /etc/my.cnf.d/mariadb-server.cnf
      force: yes

  - name: php.ini 복사
    get_url:
      url: http://data.yeonghoon.kim/centos8_npm/source/php.ini
      dest: /etc/php.ini
      force: yes

  - name: php-fpm.conf 복사
    get_url:
      url: http://data.yeonghoon.kim/centos8_npm/source/php-fpm.conf
      dest: /etc/php-fpm.conf
      force: yes

  - name: www.conf(php-fpm) 복사
    get_url:
      url: http://data.yeonghoon.kim/centos8_npm/source/www.conf
      dest: /etc/php-fpm.d/www.conf
      force: yes

  - name: test 디비 존재유무 확인(mysql_install_secure.sql 실행 유무 판단)
    stat:
      path: /var/lib/mysql/test
    register: test_db_check

  - name: mysql_secure_install.sql 파일 복사
    get_url:
      url: http://data.yeonghoon.kim/centos8_npm/source/mysql_secure_install.sql
      dest: /tmp/mysql_secure_install.sql
      force: yes
    when: test_db_check.stat.exists == False

  - name: php 구동
    service:
      name: php-fpm
      state: started
      enabled: yes

  - name: nginx 구동 및 부팅 시 구동되도록 설정
    service:
      name: nginx
      state: started
      enabled: yes

  - name: mariadb 구동 및 부팅 시 구동되도록 설정
    service:
      name: mariadb
      state: started
      enabled: yes

  - name: mysql 루트 패스워드 설정
    lineinfile:
      path: /tmp/mysql_secure_install.sql
      regexp: '^UPDATE'
      line: "UPDATE mysql.user SET Password=PASSWORD('{{ db_passwd }}') WHERE User='root';"
    when: test_db_check.stat.exists == False

  - name: mysql_secure_install.sql 실행
    shell: mysql -sfu root < /tmp/mysql_secure_install.sql
    when: test_db_check.stat.exists == False

  - name: mysql_secure_install.sql 삭제
    file:
      path: /tmp/mysql_secure_install.sql
      state: absent
    when: test_db_check.stat.exists == False

host, user, db_passwd는 상황에 맞게 수정 후 사용
방화벽 설정은 별도로 진행


  • 추천 0

  • 비추천 0
이 게시물을
목록

댓글 0

사진 및 파일 첨부

여기에 파일을 끌어 놓거나 왼쪽의 버튼을 클릭하세요.

파일 용량 제한 : 0MB (허용 확장자 : *.*)

업로드 중... (0%)

0개 첨부 됨 ( / )
 
번호 제목 글쓴이 날짜 조회 수
공지 2025 일본 여행 계획 김영훈 2024.10.10 984
공지 현금, 저축, 투자, 지출, 예산, 보험 내역(2024-05-30) 김영훈 2024.03.10 637
» CentOS8 npm 설치(저사양) - centos8_npm.yml 김영훈 2019.09.30 4661
4 kvm virt-install 예시 김영훈 2019.09.30 346
3 인터넷 익스플로러 cockpit 사용 불가 김영훈 2019.09.30 53
2 CentOS7 docker_ce 설치 - centos7_docker.yml 김영훈 2019.09.29 383
1 CentOS8 초기 설정 - centos8_init.yml 김영훈 2019.09.29 264
쓰기 태그
 첫 페이지 5 6 7 8 9 10 11 12 13 14 끝 페이지