-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure_gluon_node.yml
54 lines (45 loc) · 1.36 KB
/
configure_gluon_node.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
---
- name: Configure the hostname
command: pretty-hostname '{{ gluon_hostname }}'
delegate_to: '{{ gluon_hostname }}'
- name: Set Configured Flag on Gluon
uci:
command: set
key: "gluon-setup-mode.@setup_mode[0]"
value:
configured: 1
delegate_to: '{{ gluon_hostname }}'
- name: UCI Commit
uci:
command: commit
delegate_to: '{{ gluon_hostname }}'
- name: Check if the node is fastd or wireguard
command: test -f /lib/gluon/mesh-vpn/wireguard_pubkey.sh
register: vpn_type_is_wireguard
failed_when: False
delegate_to: '{{ gluon_hostname }}'
- name: VPN Type Wireguard
when: "vpn_type_is_wireguard.rc == 0"
block:
- name: VPN Type Wireguard - Obtain VPN Key
command: /lib/gluon/mesh-vpn/wireguard_pubkey.sh
register: vpn_key
delegate_to: '{{ gluon_hostname }}'
- name: VPN Type Wireguard - Set vpn type
set_fact:
vpn_type: wireguard
- name: VPN Type Fastd
when: "vpn_type_is_wireguard.rc != 0"
block:
- name: VPN Type Fastd - Obtain VPN Key
command: /etc/init.d/fastd show_key mesh_vpn
register: vpn_key
delegate_to: '{{ gluon_hostname }}'
- name: VPN Type Fastd - Set vpn type
set_fact:
vpn_type: fastd
- name: Store VPN Key
local_action: copy
args:
content: "{{ vpn_key.stdout_lines[0] }}\n"
dest: "{{ vpn_type }}_pubkeys/{{gluon_hostname}}"