wpdeploy.yaml
- name: MySQL Deployment
hosts: 192.168.200.102
tasks:
- name: Install MySQL Package
apt:
update_cache: true
name: mysql-server, python3-pymysql
state: present
- name: Starting MySQL Service
service:
name: mysql
state: started
enabled: yes
- name: Create Wordpress Database
mysql_db:
login_unix_socket: /var/run/mysqld/mysqld.sock
name: wpdb
state: present
- name: Create Wordpress User
mysql_user:
check_implicit_admin: yes
login_unix_socket: /var/run/mysqld/mysqld.sock
name: wpadm
password: P@ssw0rd
host: localhost
priv: wpdb.*:ALL,GRANT
state: present
- name: Wordpress Deployment
hosts: 192.168.200.102
tasks:
- name: Install Apache2 Package
apt:
name: apache2, php, php-mysql, php-gd, php-mbstring
state: present
- name: Starting Apache2 Service
service:
name: apache2
state: started
enabled: yes
- name: Download Wordpress Source
get_url:
url: https://wordpress.org/wordpress-5.8.tar.gz
checksum: sha1:6476e69305ba557694424b04b9dea7352d988110
dest: /tmp/wordpress-5.8.tar.gz
- name: Unarchive Wordpress Source
unarchive:
src: /tmp/wordpress-5.8.tar.gz
remote_src: true
dest: /var/www/html
- name: Setting Wordpress Database Configuration
copy:
src: /var/www/html/wordpress/wp-config-sample.php
dest: /var/www/html/wordpress/wp-config.php
remote_src: yes
- name: Setting Configuration for DB Name
replace:
path: /var/www/html/wordpress/wp-config.php
regexp: database_name_here
replace: wpdb
- name: Setting Configuration for User
replace:
path: /var/www/html/wordpress/wp-config.php
regexp: username_here
replace: wpadm
- name: Setting Configuration for Password
replace:
path: /var/www/html/wordpress/wp-config.php
regexp: password_here
replace: P@ssw0rd
'클라우드 > 앤서블(Ansible)' 카테고리의 다른 글
앤서블 Ansible 변수 (0) | 2021.07.29 |
---|---|
앤서블 Ansible 플레이북 ( playbook ) / wordpress 삭제 구성하기 (0) | 2021.07.29 |
앤서블 Ansible 플레이북 ( playbook ) / wordpress 구성하기 1 (0) | 2021.07.29 |
앤서블 Ansible Ad-hoc 명령으로 mysql 구성하기 (0) | 2021.07.28 |
앤서블 Ansible 파일 모듈 / 네트워크 도구 모듈 / 패키지 모듈 / 시스템 모듈 (0) | 2021.07.28 |