vi /etc/ansible/hosts
<섹션 나누기>
<플레이북 만들기>
vi wp.yml
# wordpress 경로가 설치 위치가 다를 수 있어서 살펴보고 복붙하기
- name: Setup For Wordpress
hosts: wp
gather_facts: no
become: yes
tasks:
- name: install httpd
yum:
name: httpd
state: present
- name: install wget
yum:
name: wget
state: present
- name: install unzip
yum:
name: unzip
state: present
- name: install epel-release
yum:
name: epel-release
state: present
- name: install remi-repo
yum:
name: <http://rpms.remirepo.net/enterprise/remi-release-7.rpm>
- name: install yum-utils
yum:
name: yum-utils
state: present
- name:
shell: "yum=config-manager --enable remi-php73"
- name: install php
yum:
name: php
- name: install php-mysql
yum:
name: php-mysql
- name: get wordpress
get_url:
url: <http://wordpress.org/latest.zip>
dest: ./latest.zip
- name: unzip
shell: "{{ item }}"
with_items:
- "unzip ./latest.zip"
- "mv ./wordpress/* /var/www/html"
- "cd /var/www/html"
- "cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php"
- "sed -i s/database_name_here/wp_DB/g /var/www/html/wp-config.php"
- "sed -i s/username_here/wpuser/g /var/www/html/wp-config.php"
- "sed -i s/password_here/1234/g /var/www/html/wp-config.php"
- "sed -i s/localhost/211.183.3.20/g /var/www/html/wp-config.php"
- name: restart httpd
service:
name: httpd
state: started
→→ 위에꺼 하고
ansible-playbook wp.yml -k
<ANS2>
yum install -y mariadb-server
설치 후 restart 및 enable 해주기!
mysql 입력해서 접속
create databases wpDB;
GRANT ALL PRIVILEGES on wpDB. to wpuser@'%' identified by '1234'; # ‘%’ 는 모든 대역대*
GRANT ALL PRIVILEGES on wpDB. to wpuser@'localhost' identified by '1234';*
GRANT ALL PRIVILEGES on wpDB. to wpuser@'211.183.3.20' identified by '1234'; # ‘211.183.3.20’ 에서 접속할 거니까 저것도 추가*