2016-03-05 21:46:54 +07:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: APT_REPOSITORY | Install backports
|
2017-10-03 22:57:35 +07:00
|
|
|
apt_repository:
|
|
|
|
repo: 'deb http://httpredir.debian.org/debian {{ ansible_distribution_release }}-backports main'
|
|
|
|
state: present
|
2017-10-26 15:59:24 +07:00
|
|
|
when: nginx_backports
|
2016-03-05 21:46:54 +07:00
|
|
|
|
2016-08-09 21:02:09 +07:00
|
|
|
- block:
|
2017-06-14 23:00:30 +07:00
|
|
|
|
2016-08-09 21:02:09 +07:00
|
|
|
- name: APT | Install DotDeb key
|
2017-10-03 22:57:35 +07:00
|
|
|
apt_key:
|
|
|
|
url: 'http://www.dotdeb.org/dotdeb.gpg'
|
|
|
|
state: present
|
2017-06-14 23:00:30 +07:00
|
|
|
|
2016-10-13 15:19:24 +07:00
|
|
|
- name: APT_REPOSITORY | Install dotdeb (PHP 7)
|
2017-10-03 22:57:35 +07:00
|
|
|
apt_repository:
|
|
|
|
repo: 'deb http://packages.dotdeb.org {{ ansible_distribution_release }} all'
|
|
|
|
state: present
|
2017-06-14 23:00:30 +07:00
|
|
|
|
2016-08-11 02:29:03 +07:00
|
|
|
- name: LINEFILEFILE | Dotdeb priority (prevent install nginx from dotdeb)
|
2017-10-03 22:57:35 +07:00
|
|
|
copy:
|
|
|
|
content: "Package: *\nPin: release o=packages.dotdeb.org\nPin-Priority: 100"
|
|
|
|
dest: /etc/apt/preferences
|
2017-06-14 23:00:30 +07:00
|
|
|
|
2017-10-26 15:59:24 +07:00
|
|
|
when: ansible_distribution_release == 'jessie' and dotdeb | default(false)
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: APT | Install apt-transport-https
|
|
|
|
apt:
|
|
|
|
pkg: apt-transport-https
|
|
|
|
update_cache: yes
|
|
|
|
cache_valid_time: 3600
|
|
|
|
|
|
|
|
- name: APT_KEY | Install GPG key
|
|
|
|
apt_key:
|
|
|
|
url: 'https://packages.sury.org/php/apt.gpg'
|
|
|
|
|
|
|
|
- name: APT_REPOSITORY | Add APT repository
|
|
|
|
apt_repository:
|
|
|
|
repo: 'deb https://packages.sury.org/php {{ ansible_distribution_release }} main'
|
|
|
|
|
|
|
|
when: sury | default(false)
|
2016-08-09 21:02:09 +07:00
|
|
|
|
2016-03-05 21:46:54 +07:00
|
|
|
- name: APT | Install needed packages
|
2017-10-03 22:57:35 +07:00
|
|
|
apt:
|
|
|
|
pkg: "{{ item }}"
|
|
|
|
update_cache: yes
|
|
|
|
cache_valid_time: 3600
|
|
|
|
state: present
|
2016-03-05 21:46:54 +07:00
|
|
|
with_items:
|
2017-12-03 04:22:28 +07:00
|
|
|
- cron
|
2016-03-05 21:46:54 +07:00
|
|
|
- curl
|
|
|
|
- fcgiwrap
|
2017-12-03 04:22:28 +07:00
|
|
|
- jq
|
2016-08-11 15:48:12 +07:00
|
|
|
- nghttp2
|
2016-10-13 15:19:24 +07:00
|
|
|
- strace
|
|
|
|
- vim
|
2017-12-03 04:22:28 +07:00
|
|
|
- unzip
|
|
|
|
|
|
|
|
- name: APT | Install daemonize from Stretch
|
|
|
|
apt:
|
|
|
|
deb: http://ftp.us.debian.org/debian/pool/main/d/daemonize/daemonize_1.7.7-1+b1_amd64.deb
|
2016-10-13 15:19:24 +07:00
|
|
|
|
2017-10-26 15:59:24 +07:00
|
|
|
- name: APT | Install PHP
|
2017-10-03 22:57:35 +07:00
|
|
|
apt:
|
2017-10-26 15:59:24 +07:00
|
|
|
pkg: "{{ item.version | php_fpm_package }}"
|
2017-10-03 22:57:35 +07:00
|
|
|
update_cache: yes
|
|
|
|
cache_valid_time: 3600
|
|
|
|
state: present
|
2017-10-26 15:59:24 +07:00
|
|
|
with_items: "{{ nginx_php }}"
|
2017-12-07 18:40:16 +07:00
|
|
|
register: apt_php
|
2016-10-13 15:19:24 +07:00
|
|
|
|
2017-10-26 15:59:24 +07:00
|
|
|
- name: SERVICE | Force start fcgiwrap
|
|
|
|
service:
|
|
|
|
name: "fcgiwrap"
|
|
|
|
state: started
|
2016-03-05 21:46:54 +07:00
|
|
|
|
2017-12-07 18:40:16 +07:00
|
|
|
# Bypasses Ansible 2.4 issue (cannot use service module)... With service module... php is not really started!
|
|
|
|
- name: COMMAND | Force start PHP
|
|
|
|
command: "service {{ item.version | php_fpm_service }} start"
|
2017-10-26 15:59:24 +07:00
|
|
|
with_items: "{{ nginx_php }}"
|
2017-12-07 18:40:16 +07:00
|
|
|
when: apt_php.changed
|
2017-12-03 04:22:28 +07:00
|
|
|
|
|
|
|
- name: GET_URL | Download ngrok
|
|
|
|
get_url:
|
|
|
|
url: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip"
|
|
|
|
dest: "/tmp/ngrok.zip"
|
|
|
|
|
|
|
|
- name: UNARCHIVE | Uncompress ngrok
|
|
|
|
unarchive:
|
|
|
|
src: "/tmp/ngrok.zip"
|
|
|
|
dest: "/tmp"
|
|
|
|
remote_src: yes
|
|
|
|
|
|
|
|
- name: SHELL | Check if ngrok is started
|
|
|
|
shell: ps aux | grep -q [n]grok
|
|
|
|
register: psngrok
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: SHELL | Start ngrok
|
|
|
|
shell: daemonize /tmp/ngrok http 8888 -bind-tls=false
|
|
|
|
|
|
|
|
- name: WAIT_FOR | ngrok started
|
|
|
|
wait_for:
|
|
|
|
delay: 2
|
|
|
|
port: 4040
|
|
|
|
|
|
|
|
when: psngrok.rc > 0
|
|
|
|
|
|
|
|
- name: SHELL | Get ngrok public address
|
|
|
|
shell: curl 'http://127.0.0.1:4040/api/tunnels/command_line' | jq '.public_url' | grep -oE '[[:alnum:]]+\.ngrok\.io'
|
|
|
|
register: ngrok
|
|
|
|
changed_when: false
|