-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsite.yml
88 lines (75 loc) · 1.88 KB
/
site.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
- hosts: web
tasks:
- name: install epel release (Required for nginx)
yum:
name: epel-release
state: installed
update_cache: true
- name: install packages
yum:
name: "{{ item }}"
state: installed
with_items:
- zip
- unzip
- mariadb-server
- php-mysql
- php-fpm
- nginx
- MySQL-python
- name: download latest wordpress zip file
get_url:
url: https://wordpress.org/latest.zip
dest: /usr/share/nginx/html/
register: wordpressDownload
- name: uncompress downloaded zip
unarchive:
remote_src: yes
src: "{{ wordpressDownload.dest }}"
dest: /usr/share/nginx/html/
- name: template nginx configfile
template:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: nginx
group: nginx
notify: "restart nginx"
- name: template php-fpm config
template:
src: php-fpm.conf
dest: /etc/php-fpm.d/www.conf
notify: "restart php-fpm"
- name: template wordpress config
template:
src: wp-config.php
dest: /usr/share/nginx/html/wordpress/wp-config.php
owner: nginx
group: nginx
- name: enable and start service
systemd:
state: started
enabled: true
name: "{{ item }}"
with_items:
- nginx
- php-fpm
- mariadb
- name: create mysql database
mysql_db:
name: "{{ DB_NAME }}"
state: present
- name: create mysql user
mysql_user:
name: "{{ DB_USER }}"
password: "{{ DB_PASSWORD }}"
priv: "{{ DB_NAME }}.*:ALL"
handlers:
- name: restart nginx
service:
name: nginx
state: restarted
- name: restart php-fpm
service:
name: php-fpm
state: restarted