Newer
Older
- name: "PHP 7.0 repository for {{ ansible_distribution_release }}"
apt_repository:
repo: "ppa:ondrej/php"
state: present
when: ansible_distribution_release == 'bionic'
apt:
name: "{{ php_package }}"
state: present
loop: "{{ php_packages_list }}"
loop_control:
loop_var: php_package
apt:
name: "{{ php_apache_package }}"
state: present
loop: "{{ php_apache_packages_list }}"
loop_control:
loop_var: php_apache_package
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
when: rev_proxy == "apache2"
- apache2_module:
name: "{{ item }}"
state: present
with_items: "{{ apache_module_list }}"
notify: restart apache2
when: rev_proxy == "apache2"
# TODO : review
# - name: "a2enconf php{{ php_version }}"
# command: "a2enconf php{{ php_version }}"
# register: __a2enconf_rc
# changed_when: '"service apache2 reload" in __a2enconf_rc.stdout'
# notify: restart apache2
# - name: "template for monitoring php{{ php_version }}-fpm"
# template:
# src: "php7-fpm.monit.j2"
# dest: "/etc/monit/conf.d/php{{ php_version }}.conf"
# notify: reload monit
# - name: cron stop php{{ php_version }}.service for backup
# cron:
# name: "stop php{{ php_version }}"
# hour: "{{ backup_web_stop_hour }}"
# minute: "{{ backup_web_stop_minute }}"
# job: "/bin/systemctl stop php{{ php_version }}.service"
#
# - name: cron start running php{{ php_version }}.service for backup
# cron:
# name: "start php{{ php_version }}"
# hour: "{{ backup_web_start_hour }}"
# minute: "{{ backup_web_start_minute }}"
# job: "/bin/systemctl start php{{ php_version }}.service"
- name: "redis server"
apt: name="redis-server" state=present
- name: "cron stop redis.service for backup"
cron:
name: "stop redis"
hour: "{{ backup_web_stop_hour }}"
minute: "{{ backup_web_stop_minute }}"
job: "/bin/systemctl stop redis.service"
- name: "cron start redis.service for backup"
cron:
name: "start redis"
hour: "{{ backup_web_start_hour }}"
minute: "{{ backup_web_start_minute }}"
job: "/bin/systemctl start redis.service"
- name: "template for monitoring redis"
template:
src: "redis.monit.j2"
dest: "/etc/monit/conf.d/redis.conf"
notify: reload monit
- name: "OP Cache for PHP{{ php_version }}"
lineinfile:
line: "opcache.enable=1"
insertafter: ";opcache.enable="
path: "{{ php_ini_file }}"
state: present
backup: yes
notify: reload php{{ php_version }}-fpm
- name: "OP Cache for PHP{{ php_version }}"
lineinfile:
line: "opcache.enable_cli=1"
insertafter: ";opcache.enable_cli="
path: "{{ php_ini_file }}"
state: present
notify: reload php{{ php_version }}-fpm
- name: "OP Cache for PHP{{ php_version }}"
lineinfile:
line: "opcache.memory_consumption=128"
insertafter: ";opcache.memory_consumption"
path: "{{ php_ini_file }}"
state: present
notify: reload php{{ php_version }}-fpm
- name: "OP Cache for PHP{{ php_version }}"
lineinfile:
line: "opcache.interned_strings_buffer=8"
insertafter: ";opcache.interned_strings_buffer"
path: "{{ php_ini_file }}"
state: present
notify: reload php{{ php_version }}-fpm
- name: "OP Cache for PHP{{ php_version }}"
lineinfile:
line: "opcache.max_accelerated_files=10000"
insertafter: ";opcache.max_accelerated_files"
path: "{{ php_ini_file }}"
state: present
notify: reload php{{ php_version }}-fpm
# - name: "OP Cache for PHP{{ php_version }}"
# lineinfile:
# line: "opcache.save_comments=1"
# insertafter: ";opcache.save_comments"
# path: "{{ php_ini_file }}"
# state: present
# notify: reload php{{ php_version }}-fpm
#
- name: "OP Cache for PHP{{ php_version }}"
lineinfile:
line: "opcache.revalidate_freq=1"
insertafter: ";opcache.revalidate_freq"
path: "{{ php_ini_file }}"
state: present
notify: reload php{{ php_version }}-fpm
### NGINX
- name: "env[HOSTNAME] for PHP{{ php_version }}"
lineinfile:
line: "env[HOSTNAME] = $HOSTNAME"
insertafter: ";env\\[HOSTNAME\\] = \\$HOSTNAME"
path: "{{ php_www_conf_file }}"
state: present
backup: yes
notify: reload php7.0-fpm
- name: "env[PATH] for PHP{{ php_version }}"
lineinfile:
line: "env[PATH] = /usr/local/bin:/usr/bin:/bin"
insertafter: ";env\\[PATH\\] = /usr/local/bin:/usr/bin:/bin"
path: "{{ php_www_conf_file }}"
state: present
notify: reload php7.0-fpm
- name: "env[TMP] for PHP{{ php_version }}"
lineinfile:
line: "env[TMP] = /tmp"
insertafter: ";env\\[TMP\\] = /tmp"
path: "{{ php_www_conf_file }}"
state: present
notify: reload php{{ php_version }}-fpm
- name: "env[TMPDIR] for PHP{{ php_version }}"
lineinfile:
line: "env[TMPDIR] = /tmp"
insertafter: ";env\\[TMPDIR\\] = /tmp"
path: "{{ php_www_conf_file }}"
state: present
notify: reload php{{ php_version }}-fpm
- name: "env[TEMP] for PHP{{ php_version }}"
lineinfile:
line: "env[TEMP] = /tmp"
insertafter: ";env\\[TEMP\\] = /tmp"
path: "{{ php_www_conf_file }}"
state: present
notify: reload php{{ php_version }}-fpm