mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-04-09 12:42:10 +07:00
Manage FreeBSD 11
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
---
|
||||
|
||||
- name: APT | Install web apps
|
||||
pkgng:
|
||||
pkg: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- nagios
|
||||
- backuppc
|
||||
|
||||
- name: COMMAND | Activate backuppc config
|
||||
command: >
|
||||
cp /usr/local/etc/backuppc/config.pl.sample /usr/local/etc/backuppc/config.pl
|
||||
creates=/usr/local/etc/backuppc/config.pl
|
||||
|
||||
- name: FILE | Fix backuppc permissions
|
||||
file:
|
||||
path: /usr/local/etc/backuppc/config.pl
|
||||
owner: backuppc
|
||||
group: backuppc
|
||||
|
||||
- name: FILE | Fix fcgiwrap permission
|
||||
file:
|
||||
path: "{{ nginx_fcgiwrap_sock }}"
|
||||
mode: 0640
|
||||
owner: "{{ nginx_user }}"
|
||||
group: "{{ nginx_user }}"
|
||||
#- name: APT | Install web apps
|
||||
# pkgng:
|
||||
# pkg: "{{ item }}"
|
||||
# state: present
|
||||
# with_items:
|
||||
# - nagios
|
||||
# - backuppc
|
||||
#
|
||||
#- name: COMMAND | Activate backuppc config
|
||||
# command: >
|
||||
# cp /usr/local/etc/backuppc/config.pl.sample /usr/local/etc/backuppc/config.pl
|
||||
# creates=/usr/local/etc/backuppc/config.pl
|
||||
#
|
||||
#- name: FILE | Fix backuppc permissions
|
||||
# file:
|
||||
# path: /usr/local/etc/backuppc/config.pl
|
||||
# owner: backuppc
|
||||
# group: backuppc
|
||||
#
|
||||
#- name: FILE | Fix fcgiwrap permission
|
||||
# file:
|
||||
# path: "{{ nginx_fcgiwrap_sock }}"
|
||||
# mode: 0640
|
||||
# owner: "{{ nginx_user }}"
|
||||
# group: "{{ nginx_user }}"
|
||||
|
||||
#
|
||||
# We don't manage BackupPC on FreeBSD... too dirty. :/
|
||||
|
||||
@@ -94,25 +94,6 @@
|
||||
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
|
||||
- name: SET_FACT | ngrok_path
|
||||
set_fact:
|
||||
ngrok_path: '/tmp/ngrok'
|
||||
|
||||
@@ -2,23 +2,35 @@
|
||||
|
||||
- name: SET_FACT | FreeBSD web user
|
||||
set_fact:
|
||||
nginx_pkgng_package: 'nginx-devel'
|
||||
nginx_pkgng_package: 'nginx-full'
|
||||
nginx_user: 'www'
|
||||
nginx_php:
|
||||
- version: '5.6'
|
||||
- version: '7.2'
|
||||
sockets:
|
||||
- host: '127.0.0.1'
|
||||
port: 9000
|
||||
nginx_load_modules:
|
||||
- /usr/local/libexec/nginx/ngx_http_geoip_module.so
|
||||
ngrok_path: '/usr/local/bin/ngrok'
|
||||
|
||||
- name: PKGNG | Install needed packages
|
||||
pkgng:
|
||||
pkg: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- php56
|
||||
- curl
|
||||
- daemonize
|
||||
- fcgiwrap
|
||||
- GeoIP
|
||||
- jq
|
||||
- nghttp2
|
||||
- php72
|
||||
- vim
|
||||
|
||||
- name: COMMAND | Get geoip database
|
||||
command: geoipupdate.sh
|
||||
args:
|
||||
creates: /usr/local/share/GeoIP/GeoIP.dat
|
||||
|
||||
- name: SERVICE | Force start services
|
||||
service:
|
||||
@@ -29,3 +41,25 @@
|
||||
with_items:
|
||||
- php-fpm
|
||||
- fcgiwrap
|
||||
|
||||
- name: STAT | Check ports
|
||||
stat:
|
||||
path: /usr/ports
|
||||
register: ports
|
||||
|
||||
- block:
|
||||
|
||||
- name: COMMAND | Get ports
|
||||
command: portsnap fetch --interactive
|
||||
|
||||
- name: COMMAND | Extract ports
|
||||
command: portsnap extract
|
||||
no_log: true
|
||||
|
||||
when: not ports.stat.exists
|
||||
|
||||
- name: SHELL | Install ngrok
|
||||
shell: make install clean DISABLE_LICENSES=yes
|
||||
args:
|
||||
chdir: /usr/ports/security/ngrok
|
||||
creates: "{{ ngrok_path }}"
|
||||
|
||||
18
tests/includes/pre_common.yml
Normal file
18
tests/includes/pre_common.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
|
||||
- name: SHELL | Start ngrok
|
||||
shell: daemonize -l /tmp/ngrok {{ ngrok_path }} http 8888 -bind-tls=false
|
||||
failed_when: false
|
||||
changed_when: ngrok.stderr.find("Can't lock the lock file") == -1
|
||||
register: ngrok
|
||||
|
||||
- name: WAIT_FOR | ngrok started
|
||||
wait_for:
|
||||
delay: 2
|
||||
port: 4040
|
||||
when: ngrok.changed
|
||||
|
||||
- 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
|
||||
Reference in New Issue
Block a user