-
Notifications
You must be signed in to change notification settings - Fork 9
/
site.yml
142 lines (118 loc) · 3.63 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Ansible Playbook for Subutai WordPress blueprint
---
- hosts: wp
remote_user: root
tasks:
- name: Upgrade debian
apt:
update_cache: true
upgrade: "yes"
- name: Install required debs
apt:
name:
- php
- php-cgi
- php-mysql
- apache2
- libapache2-mod-php
- unzip
- mariadb-server
- mariadb-client
- python-mysqldb
state: present
- name: Install limits.ini
template:
src: files/limits.ini
dest: /etc/php/7.3/mods-available/limits.ini
- name: Activate limits.ini
shell: phpenmod limits
- name: Create database
mysql_db:
name: wordpress
state: present
encoding: utf8
- name: Create database user
mysql_user:
name: wordpress
password: wordpress
priv: "wordpress.*:ALL"
- name: Get wp-cli
get_url:
url: https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
dest: /usr/local/bin/wp
validate_certs: no
- name: Make wp-cli executable
file:
path: /usr/local/bin/wp
state: touch
mode: u+rwx,g+rx,o+rx
- name: Download WP Core
shell: wp core download --allow-root
args:
chdir: /var/www/html
creates: /var/www/html/index.php
- name: Create WP Config
shell: wp config create --dbname=wordpress --dbuser=wordpress --dbpass=wordpress --allow-root
args:
chdir: /var/www/html
creates: /var/www/html/wp-config.php
- name: Install WP
shell: wp core install --url='{{domain_name}}' --title='{{site_title}}' --admin_user='{{admin_user}}' --admin_password='{{admin_pwd}}' --admin_email='[email protected]' --skip-email --allow-root
args:
chdir: /var/www/html
- name: Set site description
shell: wp option update blogdescription '{{site_description}}' --allow-root
args:
chdir: /var/www/html
- name: Copy subutai theme
copy:
src: files/subutai
dest: /var/www/html/wp-content/themes
owner: www-data
group: www-data
- name: Set theme
shell: wp theme install twentyseventeen --allow-root
args:
chdir: /var/www/html
- name: Activate subutai theme
shell: wp theme activate subutai --allow-root
args:
chdir: /var/www/html
- name: Change to https
shell: wp search-replace 'http://{{domain_name}}' 'https://{{domain_name}}' --allow-root
args:
chdir: /var/www/html
- name: Insert extra config
blockinfile:
path: /var/www/html/wp-config.php
marker: "/* {mark} ANSIBLE MANAGED BLOCK */"
insertafter: '^\$table_prefix.*$'
block: |
if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
{
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = '443';
define('FORCE_SSL_ADMIN', true);
}
if ( isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}
- name: Delete Unused Plugins
shell: wp plugin delete akismet hello --allow-root
args:
chdir: /var/www/html
- name: Remove original index.html
file:
name: /var/www/html/index.html
state: absent
- name: Change ownership
file:
path: /var/www/html
recurse: yes
owner: www-data
group: www-data
- name: Restart apache
service:
name: apache2
state: restarted
# vim: ts=2 et nowrap autoindent