-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-ngrok.yml
62 lines (53 loc) · 1.81 KB
/
start-ngrok.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
- hosts: all
remote_user: root
pre_tasks:
- name: Install python for server
raw: test -e /usr/bin/python || (apt -y update && apt install -y python)
tasks:
- name: Mkdir /tmp/qs-ngrok
file:
path: /tmp/qs-ngrok
state: directory
- name: Build ngrok image
shell: >
docker build -t qs-ngrok --build-arg ngrok_domain={{ domain }}
--build-arg goos={{ goos }} --build-arg goarch={{ goarch }}
https://raw.githubusercontent.com/charact3/qs-ngrok/master/docker/Dockerfile
# - name: Build ngrok client
# docker_container:
# image: qs-ngrok
# name: qs-ngrok-client
# state: started
# command: /bin/sh -c "cd /ngrok && GOOS=darwin make release-client && sleep 100000"
# tags: [client]
- name: Run ngrok server
docker_container:
image: qs-ngrok
name: qs-ngrok
state: started
restart: yes
ports:
- "{{ http_port }}:{{ http_port }}"
- "{{ https_port }}:{{ https_port }}"
- "{{ tunnel_port }}:{{ tunnel_port }}"
env:
DOMAIN: "{{ domain }}"
TUNNEL_PORT: "{{ tunnel_port }}"
HTTP_PORT: "{{ http_port }}"
HTTPS_PORT: "{{ https_port }}"
command: "/bin/sh -c /ngrok/run_server.sh"
tags:
- start_ngrok
- name: Docker copy ngrok client
shell: docker cp qs-ngrok:/ngrok/bin /tmp/qs-ngrok/
tags: [client]
- name: Fetch ngrok client
fetch:
src: /tmp/qs-ngrok/bin/{{ goos }}_{{ goarch }}/{{ 'ngrok.exe' if goos == 'windows' else 'ngrok'}}
dest: ./
flat: yes
tags: [client]
- name: Create ngrok config
local_action: template src=ngrok.cfg.j2 dest=ngrok.cfg
tags: [client]