Skip to content

Commit 1aed00a

Browse files
committed
Simplified provisioning
Needs VERSION 4 docker images
1 parent 9756867 commit 1aed00a

File tree

9 files changed

+38
-113
lines changed

9 files changed

+38
-113
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
---
2-
PROVISION_CONTEXT: "{{ lookup('env','PROVISION_CONTEXT') }}"
2+
3+
PROVISION_CONTEXT: "{{ lookup('env','PROVISION_CONTEXT') }}"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
---
2-
PROVISION_CONTEXT: "{{ lookup('env','PROVISION_CONTEXT') }}"
2+
3+
PROVISION_CONTEXT: "{{ lookup('env','PROVISION_CONTEXT') }}"

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

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,6 @@
55

66
- include_vars: "/opt/docker/etc/application.{{ PROVISION_CONTEXT }}.yml"
77

8-
- stat: path=/usr/sbin/php-fpm7.0
9-
register: php7_debian
10-
11-
- name: Fact - php5 [RedHat family]
12-
set_fact:
13-
php_pool_conf: /etc/php-fpm.d/www.conf
14-
php_base_path: false
15-
when: ansible_os_family == 'RedHat'
16-
17-
- name: Fact - php5 [Debian family]
18-
set_fact:
19-
php_pool_conf: /etc/php5/fpm/pool.d/www.conf
20-
php_base_path: /etc/php5
21-
when: ansible_os_family == 'Debian'
22-
23-
- name: Fact - php7 [Debian family]
24-
set_fact:
25-
php_pool_conf: /etc/php/7.0/fpm/pool.d/www.conf
26-
php_base_path: /etc/php/7.0
27-
when: ansible_os_family == 'Debian' and php7_debian.stat.exists is defined and php7_debian.stat.exists
28-
298
#############################
309
# Run tasks
3110
#############################
@@ -38,21 +17,20 @@
3817

3918
- include: bootstrap/composer.yml
4019
when: PROVISION.install.phpComposer is defined and PROVISION.install.phpComposer
20+
4121
- include: bootstrap/cron.yml
22+
4223
- include: bootstrap/dnsmasq.yml
4324
when: DNS is defined
25+
4426
- include: bootstrap/postfix.yml
4527
when: MAIL is defined
4628

47-
- include: bootstrap/php.redhat.yml php_base_path="{{ php_base_path }}"
48-
when: ansible_os_family == 'RedHat'
49-
50-
- include: bootstrap/php.debian.yml php_base_path="{{ php_base_path }}"
51-
when: ansible_os_family == 'Debian'
52-
53-
- include: bootstrap/php.yml php_pool_conf="{{ php_pool_conf }}"
29+
- include: bootstrap/php.yml
5430

5531
- include: bootstrap/web.apache.yml
32+
5633
- include: bootstrap/web.apache.pagespeed.yml
5734
when: PROVISION.install.apacheModPagespeed is defined and PROVISION.install.apacheModPagespeed
35+
5836
- include: bootstrap/web.nginx.yml

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
line: 'address=/{{ item.domain }}/{{ item.address }}'
1010
create: yes
1111
with_items: "{{ DNS.domain }}"
12-
when: DNS.domain is defined
12+
when: DNS.domain is defined

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

Lines changed: 0 additions & 29 deletions
This file was deleted.

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

Lines changed: 0 additions & 8 deletions
This file was deleted.

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,32 @@
44

55
- name: Configure php-fpm (pool www.conf)
66
lineinfile:
7-
dest: "{{ php_pool_conf }}"
7+
dest: "/opt/docker/etc/php/fpm/pool.d/application.conf"
88
regexp: '^[\s;]*{{ item.variable }}[\s]*='
99
line: '{{ item.variable }} = {{ item.value }}'
1010
with_items: "{{ PHP.fpm.conf }}"
1111
when: PHP.fpm.conf is defined and item.value != ""
12+
13+
- name: Configure php-fpm (php-fpm.conf)
14+
lineinfile:
15+
dest: "/opt/docker/etc/php/fpm/php-fpm.conf"
16+
regexp: '^[\s;]*{{ item.key }}[\s]*='
17+
line: '{{ item.key }} = {{ item.value }}'
18+
with_items:
19+
- { key: 'daemonize', value: 'no' }
20+
21+
- name: Set development environment php.ini
22+
file:
23+
src: '/opt/docker/etc/php/development.ini'
24+
dest: '/opt/docker/etc/php/php.ini'
25+
state: link
26+
force: yes
27+
when: PROVISION_CONTEXT == "development"
28+
29+
- name: Enable production environment php.ini
30+
file:
31+
src: '/opt/docker/etc/php/production.ini'
32+
dest: '/opt/docker/etc/php/php.ini'
33+
state: link
34+
force: yes
35+
when: PROVISION_CONTEXT == "production" or PROVISION_CONTEXT == ""
Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,4 @@
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-
293
- include: entrypoint/mysql.yml
30-
- include: entrypoint/php.yml php_pool_conf="{{ php_pool_conf }}"
4+
- include: entrypoint/php.yml

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

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,8 @@
55

66
- name: Configure environment variables from DOCKER_ENVIRONMENT for php-fpm (pool www.conf)
77
lineinfile:
8-
dest: "{{ php_pool_conf }}"
8+
dest: "/opt/docker/etc/php/fpm/pool.d/application.conf"
99
regexp: '^env\[{{ item.key }}\][\s]*='
1010
line: 'env[{{ item.key }}] = "{{ item.value }}"'
1111
with_dict: "{{ DOCKER_ENVIRONMENT }}"
1212
when: DOCKER_ENVIRONMENT is defined and item.value != ''
13-
14-
- name: Set development environment php.ini
15-
file:
16-
src: '/opt/docker/etc/php/development.ini'
17-
dest: '/opt/docker/etc/php/php.ini'
18-
state: link
19-
force: yes
20-
when: PROVISION_CONTEXT == "development" or PROVISION_CONTEXT == ""
21-
22-
- name: Enable production environment php.ini
23-
file:
24-
src: '/opt/docker/etc/php/production.ini'
25-
dest: '/opt/docker/etc/php/php.ini'
26-
state: link
27-
force: yes
28-
when: PROVISION_CONTEXT == "production"

0 commit comments

Comments
 (0)