Skip to content

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
i-ryuu committed Jun 6, 2017
1 parent 93ffb59 commit c06d0cc
Show file tree
Hide file tree
Showing 6 changed files with 581 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

# Created by https://www.gitignore.io/api/macos,ansible

### Ansible ###
# Ansible retry files
*.retry

# Test driven development on Ansible with Molecule, Testinfra and pytest
.cache/
.idea/
.molecule/
.tox/
__pycache__/
tests/roles
*.pyc

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# End of https://www.gitignore.io/api/macos,ansible
15 changes: 15 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

php_version: 7.1
php_timezone: Asia/Tokyo
php_error_log: /var/log/php_errors.log
php_post_max_size: 20M
php_upload_max_filesize: 30M
php_memory_limit: 256M
php_display_errors: On
php_display_startup_errors: On

# Fast CGI
phpFpm_user: www-fpm
phpFpm_group: www-fpm
phpFpm_socket_path: "/var/run/php/php{{ php_version }}-fpm.sock"
7 changes: 7 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

- name: restart php-fpm
service:
name: php7.1-fpm
state: restarted
enabled: yes
89 changes: 89 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---

- name: add php apt repository
become: yes
apt_repository:
repo: ppa:ondrej/php
state: present
update_cache: yes

- name: "install php{{ php_version }}-fpm"
become: yes
apt:
name: "php{{ php_version }}-{{ item }}"
state: present
with_items:
- fpm
- mysql
- mbstring
- curl
- xml
- gd

- name: install php ssh extension with dependency
become: yes
apt:
name: "{{ item }}"
state: present
with_items:
- "libssh2-1"
- "php-ssh2"

- name: update php.ini file
become: yes
lineinfile:
dest: "/etc/php/{{ php_version }}/fpm/php.ini"
state: present
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- regexp: "^error_log = syslog"
line: "error_log = {{ php_error_log }}"
- regexp: "^;date.timezone"
line: "date.timezone = {{ php_timezone }}"
- regexp: "^;mbstring.language"
line: "mbstring.language = Japanese"
- regexp: "^memory_limit = "
line: "memory_limit = {{ php_memory_limit }}"
- regexp: "^post_max_size = "
line: "post_max_size = {{ php_post_max_size }}"
- regexp: "^upload_max_filesize = "
line: "upload_max_filesize = {{ php_upload_max_filesize }}"
- regexp: "^display_errors = "
line: "display_errors = {{ php_display_errors }}"
- regexp: "^display_startup_errors = "
line: "display_startup_errors = {{ php_display_startup_errors }}"
# opcache
- regexp: "^;opcache.enable="
line: "opcache.enable = 1"

- name: update pool.d file
become: yes
lineinfile:
dest: "/etc/php/{{ php_version }}/fpm/pool.d/www.conf"
state: present
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- regexp: "^group = www-data"
line: "group = {{ phpFpm_group }}"
- regexp: "^user = www-data"
line: "user = {{ phpFpm_user }}"

- regexp: "^listen = "
line: "listen = {{ phpFpm_socket_path }}"

- regexp: "^listen.owner = "
line: "listen.owner = {{ phpFpm_user }}"
- regexp: "^listen.group = "
line: "listen.group = {{ phpFpm_group }}"

- regexp: "^;listen.allowed_clients = 127.0.0.1"
line: "listen.allowed_clients = 127.0.0.1"

- name: Install Composer package manager
become: yes
apt:
name: composer
state: present
notify: restart php-fpm
13 changes: 13 additions & 0 deletions templates/index.php.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html>
<head>
<title>index!!!</title>
</head>
<body>
<?php

phpinfo();

?>
</body>
</html>
Loading

0 comments on commit c06d0cc

Please sign in to comment.