-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
playbook.yml
56 lines (52 loc) · 1.61 KB
/
playbook.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
---
- name: 'Installing'
hosts: localhost
connection: local
become: true
tasks:
- block: # Yggdrasil Network
- name: Get DEB architecture
shell: dpkg --print-architecture
register: deb_architecture
- name: Download Yggstack
get_url:
url: "https://github.com/yggdrasil-network/yggstack/releases/download/trunk/yggstack-linux-{{ deb_architecture.stdout }}"
dest: /usr/local/bin/yggstack
mode: u=rwx,g=rx,o=rx
- name: See if the config file exists
stat:
path: /etc/yggdrasil/yggdrasil.conf
register: config_exists
- name: Create the config file
file:
path: "{{ item.path }}"
state: "{{ item.state }}"
mode: u=rwx,g=rx,o=
loop:
- { path: /etc/yggdrasil, state: directory }
- { path: /etc/yggdrasil/yggdrasil.conf, state: touch }
when: not config_exists.stat.exists
- name: Generate config
shell: /usr/local/bin/yggstack -genconf > /etc/yggdrasil/yggdrasil.conf
when: not config_exists.stat.exists
- name: Add uplink
replace:
path: /etc/yggdrasil/yggdrasil.conf
regexp: 'Peers: \[\]'
replace: |-
Peers: [
tls://ygg-uplink.thingylabs.io:443
]
when: not config_exists.stat.exists
- block: # Install systemd service
- name: 'Create systemd service file'
copy:
force: true
src: yggstack.service
dest: /etc/systemd/system/yggstack.service
- name: 'Enable and start service'
systemd:
name: yggstack
daemon_reload: true
enabled: true
state: started