Skip to content

Commit 9409e9c

Browse files
committed
Switches ton ondej PPA and adds tests
Switched to ondej PPA to get more recent PHP versions Added vagrant tests
1 parent f57677c commit 9409e9c

File tree

13 files changed

+113
-20
lines changed

13 files changed

+113
-20
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.tags
2-
2+
.vagrant
3+
*.log

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
php7-fpm Ansible playbook
2-
=========================
1+
php7-fpm Ansible role
2+
=====================
33

4-
This playbook will install php7-fpm in Xenial (16.04)
4+
This role will install php7-fpm in Xenial (16.04)
55

66
Requirements
77
------------

Vagrantfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Vagrant.configure(2) do |config|
2+
config.vm.box = "ubuntu/xenial64"
3+
4+
config.vm.provider "virtualbox" do |v|
5+
v.linked_clone = true
6+
end
7+
8+
config.vm.define "php7" do |php7|
9+
end
10+
11+
config.vm.provision "shell",
12+
:path => "vagrant_specs.sh",
13+
:upload_path => "/home/ubuntu/specs",
14+
# change role name below
15+
:args => "--install ansible-php7-fpm"
16+
end

handlers/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- name: Restart php7-fpm
2-
service: name=php7.0-fpm state=restarted
3-
notify:
4-
- Restart nginx
2+
service:
3+
name: php{{ php7_version }}-fpm
4+
state: restarted
5+

meta/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ galaxy_info:
1616
categories:
1717
- development
1818

19-
dependencies:
20-
- role: ansible-nginx
19+
dependencies: []
2120

tasks/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
- include: php7-fpm.yml tags=php7-fpm
1+
- include: php7-fpm.yml
2+
tags: ["php7-fpm"]

tasks/php7-fpm.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,46 @@
1+
- name: Adds ondrej repos
2+
apt_repository:
3+
repo: "ppa:ondrej/php"
4+
update_cache: yes
5+
6+
- name: Show selected php7_version
7+
debug: msg="Deploying php7 version {{ php7_version }}"
8+
19
- name: Installs php7-fpm
2-
apt:
10+
apt:
311
pkg: "{{ item }}"
412
state: latest
513
update_cache: yes
614
notify:
715
- Restart php7-fpm
816
with_items:
9-
- php7.0-fpm
17+
- composer
18+
- php{{ php7_version }}-fpm
1019
- php-apcu
11-
- php7.0-mcrypt
12-
- php7.0-gd
13-
- php7.0-curl
20+
- php{{ php7_version }}-mcrypt
21+
- php{{ php7_version }}-gd
22+
- php{{ php7_version }}-curl
1423
- php-pear
15-
- php7.0-mysql
24+
- php{{ php7_version }}-mysql
1625

1726
- name: Adds php.ini
18-
template:
27+
template:
1928
src: "../templates/php.ini.j2"
20-
dest: /etc/php/7.0/fpm/php.ini
29+
dest: /etc/php/{{ php7_version }}/fpm/php.ini
2130
backup: yes
2231
notify:
2332
- Restart php7-fpm
24-
- Restart nginx
33+
34+
- name: Checks if nginx is already installed
35+
stat:
36+
path: /etc/nginx/conf.d/
37+
register: __nginx_config_dir
2538

2639
- name: Adds nginx buffer tuning
2740
template:
2841
src: "../templates/fastcgi_buffers.conf.j2"
2942
dest: /etc/nginx/conf.d/fastcgi_buffers.conf
43+
when: __nginx_config_dir is defined and __nginx_config_dir.isdir is defined and __nginx_config_dir.isdir
3044
notify:
3145
- Restart php7-fpm
3246
- Restart nginx
@@ -40,4 +54,3 @@
4054
shell: pear install {{ item }}
4155
with_items: pear.packages
4256
when: pear is defined
43-
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
placeholder_fqdn
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ubuntu-xenial.localdomain
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
3+
- hosts: all
4+
sudo: true
5+
6+
roles:
7+
- role: ansible-php7-fpm

0 commit comments

Comments
 (0)