-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzerotier_one_set_ip.sls
57 lines (45 loc) · 1.6 KB
/
zerotier_one_set_ip.sls
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
{% set hostvars = salt['pillar.get'](opts.id) %}
{% set groupvars = salt['pillar.get']('group_vars') %}
# zt global network id
{% set zt_network_id = salt['pillar.get']('secrets:zt_network') %}
# zt api access token
{% set token = salt['pillar.get']('secrets:zt_controller_token') %}
{% set script_final_line = "'{\"config\": {\"ipAssignments\": [\"" + hostvars.zt_ip +"\"]} }'" %}
{% set token_local = salt['zt_module.get_auth_token']() %}
{% set zerotier_status = salt['zt_module.get_node_id'](token=token_local.token) %}
zt_module.set_ip:
module.run:
# variables / params / args
- token: {{token}}
- zt_network_id: {{zt_network_id}}
- zt_node_id: {{zerotier_status.address}}
- ip_address: {{hostvars.zt_ip}}
zt_module.set_name:
module.run:
# variables / params / args
- token: {{token}}
- zt_network_id: {{zt_network_id}}
- zt_node_id: {{zerotier_status.address}}
- zt_name: {{opts.id}}
zt_module.set_description:
module.run:
# variables / params / args
- token: {{token}}
- zt_network_id: {{zt_network_id}}
- zt_node_id: {{zerotier_status.address}}
- description: {{opts.id}}
#zerotier_one_set_ip:
# cmd.script:
# - name: salt://scripts/zerotier_one_set_ip.sh
# - template: jinja
# # Pass script usable variables in via context dictionary
# - context:
# zt_network_id: {{zt_network_id}}
# zt_member_id: {{ zerotier_status.address }}
# token: {{token}}
# script_final_line: {{script_final_line}}
# - onlyif:
# - zerotier-cli
# - require:
# - sls: zerotier_one_install
# - sls: zerotier_one_configure