-
Notifications
You must be signed in to change notification settings - Fork 0
/
gateway.yml
62 lines (53 loc) · 1.59 KB
/
gateway.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
---
- name: Configure homelab gateway server (Debain)
hosts: "*"
remote_user: root
pre_tasks:
- name: update
ansible.builtin.include_tasks:
file: tasks/apt.yml
- name: Install packages
apt:
pkg:
- docker.io
- name: Crate docker stack dir
ansible.builtin.file:
path: ~/compose-files/
state: directory
- name: Copy compose files
ansible.builtin.copy:
src: docker
dest: ~/compose-files
- name: Copy secrets file
ansible.builtin.copy:
decrypt: true
src: secrets.env
dest: ~/compose-files
tasks:
# allows ansible to easily connect back for updates
- name: install and configure tailscale
ansible.builtin.include_tasks:
file: tasks/tailscale.yml
vars:
tailscale_hostname: gateway
- name: Get rathole token
ansible.builtin.shell:
cat ~/compose-files/secrets.env | grep RATHOLE_TOKEN | sed 's/^.*RATHOLE_TOKEN=//'
register: rathole_token
ignore_errors: true
changed_when: false
- name: Replace rathole tokens with secret
ansible.builtin.replace:
path: ~/compose-files/docker/rathole/rathole.toml
regexp: '"token"'
replace: '"{{ rathole_token.stdout }}"'
- name: Start Rathole container
docker_container:
name: "rathole"
recreate: yes
image: rapiz1/rathole
network_mode: "host"
user: root
volumes:
- /root/compose-files/docker/rathole/rathole.toml:/app/config.toml
command: --server /app/config.toml