Skip to content

Commit 2b39f1a

Browse files
committed
Simplified provisioning
Fixed also php7 support
1 parent dec092a commit 2b39f1a

File tree

6 files changed

+62
-29
lines changed

6 files changed

+62
-29
lines changed

provision/roles/boilerplate-main/tasks/bootstrap.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
11
---
2+
#############################
3+
# Gather environment stuff
4+
#############################
25

36
- include_vars: "/opt/docker/etc/application.{{ PROVISION_CONTEXT }}.yml"
47

8+
- stat: path=/usr/sbin/php-fpm7.0
9+
register: php7_debian
10+
11+
- name: Fact - php5 pool [RedHat family]
12+
set_fact:
13+
php_pool_conf: /etc/php-fpm.d/www.conf
14+
when: ansible_os_family == 'RedHat'
15+
16+
- name: Fact - php5 pool [Debian family]
17+
set_fact:
18+
php_pool_conf: /etc/php5/fpm/pool.d/www.conf
19+
php_base_path: /etc/php5
20+
when: ansible_os_family == 'Debian'
21+
22+
- name: Fact - php7 pool [Debian family]
23+
set_fact:
24+
php_pool_conf: /etc/php/7.0/fpm/pool.d/www.conf
25+
php_base_path: /etc/php/7.0
26+
when: ansible_os_family == 'Debian' and php7_debian.stat.exists is defined and php7_debian.stat.exists
27+
28+
#############################
29+
# Run tasks
30+
#############################
31+
532
- include: bootstrap/systemUpdate.centos.yml
633
when: PROVISION.systemUpdate is defined and PROVISION.systemUpdate and ansible_distribution == 'CentOS'
734

@@ -16,13 +43,13 @@
1643
- include: bootstrap/postfix.yml
1744
when: MAIL is defined
1845

19-
- include: bootstrap/php.centos.yml
20-
when: ansible_distribution == 'CentOS'
46+
- include: bootstrap/php.redhat.yml
47+
when: ansible_os_family == 'RedHat'
2148

22-
- include: bootstrap/php.ubuntu.yml
23-
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'
49+
- include: bootstrap/php.debian.yml php_base_path="{{ php_base_path }}"
50+
when: ansible_os_family == 'Debian'
2451

25-
- include: bootstrap/php.yml
52+
- include: bootstrap/php.yml php_pool_conf="{{ php_pool_conf }}"
2653

2754
- include: bootstrap/web.apache.yml
2855
- include: bootstrap/web.nginx.yml

provision/roles/boilerplate-main/tasks/bootstrap/php.ubuntu.yml renamed to provision/roles/boilerplate-main/tasks/bootstrap/php.debian.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
- name: Create /etc/php5/mods-available/
44
file:
5-
path: /etc/php5/mods-available/
5+
path: "{{ php_base_path }}/mods-available/"
66
state: directory
77
mode: 0755
88

99
- name: Link php.ini for cli and fpm
1010
file:
1111
src: '{{ item.file }}'
12-
dest: '/etc/php5/{{ item.category }}/conf.d/{{ item.target }}'
12+
dest: '{{ php_base_path }}/{{ item.category }}/conf.d/{{ item.target }}'
1313
force: yes
1414
state: link
1515
with_items:
@@ -22,7 +22,7 @@
2222

2323
- name: Configure php-fpm (php-fpm.conf)
2424
lineinfile:
25-
dest: /etc/php5/fpm/php-fpm.conf
25+
dest: "{{ php_base_path }}/fpm/php-fpm.conf"
2626
regexp: '^[\s;]*{{ item.key }}[\s]*='
2727
line: '{{ item.key }} = {{ item.value }}'
2828
with_items:

provision/roles/boilerplate-main/tasks/bootstrap/php.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
- include_vars: "/opt/docker/etc/application.{{ PROVISION_CONTEXT }}.yml"
44

5-
- name: Fact - php pool on centos
6-
set_fact:
7-
php_pool_conf: /etc/php-fpm.d/www.conf
8-
when: ansible_distribution == 'CentOS'
9-
10-
- name: Fact - php pool on ubuntu
11-
set_fact:
12-
php_pool_conf: /etc/php5/fpm/pool.d/www.conf
13-
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'
14-
155
- name: Configure php-fpm (pool www.conf)
166
lineinfile:
177
dest: "{{ php_pool_conf }}"
Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
11
---
22

3+
#############################
4+
# Gather environment stuff
5+
#############################
6+
7+
- stat: path=/usr/sbin/php-fpm7.0
8+
register: php7_debian
9+
10+
- name: Fact - php5 pool [RedHat family]
11+
set_fact:
12+
php_pool_conf: /etc/php-fpm.d/www.conf
13+
when: ansible_os_family == 'RedHat'
14+
15+
- name: Fact - php5 pool [Debian family]
16+
set_fact:
17+
php_pool_conf: /etc/php5/fpm/pool.d/www.conf
18+
when: ansible_os_family == 'Debian'
19+
20+
- name: Fact - php7 pool [Debian family]
21+
set_fact:
22+
php_pool_conf: /etc/php/7.0/fpm/pool.d/www.conf
23+
when: ansible_os_family == 'Debian' and php7_debian.stat.exists is defined and php7_debian.stat.exists
24+
25+
#############################
26+
# Run tasks
27+
#############################
28+
329
- include: entrypoint/mysql.yml
4-
- include: entrypoint/php.yml
30+
- include: entrypoint/php.yml php_pool_conf="{{ php_pool_conf }}"

provision/roles/boilerplate-main/tasks/entrypoint/php.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@
33
- include_vars: "/opt/docker/etc/application.{{ PROVISION_CONTEXT }}.yml"
44
- include_vars: "/opt/docker/etc/application.environment.yml"
55

6-
- name: Fact - php pool on centos
7-
set_fact:
8-
php_pool_conf: /etc/php-fpm.d/www.conf
9-
when: ansible_distribution == 'CentOS'
10-
11-
- name: Fact - php pool on ubuntu
12-
set_fact:
13-
php_pool_conf: /etc/php5/fpm/pool.d/www.conf
14-
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'
15-
166
- name: Configure environment variables from DOCKER_ENVIRONMENT for php-fpm (pool www.conf)
177
lineinfile:
188
dest: "{{ php_pool_conf }}"

0 commit comments

Comments
 (0)