blob: b56cb0fa30969b2da02356daa8b76b267c0ec797 (
plain)
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
|
---
- name: "get salamaner public key"
ansible.builtin.slurp:
path: "/var/reactance/xray/xray_public_key"
register: xray_pub_key_b64e
- name: "vless user management"
xray:
users: "{{ all_users|default([]) + vless_users|default([]) }}"
protocol: vless
address: "{{ ansible_default_ipv4.interface|default(ansible_all_ipv4_addresses[0]) }}"
service_port: "{{ vless_port|default(4437) }}"
public_key: "{{ xray_pub_key_b64e.content|b64decode }}"
when: inventory_hostname in (groups['vless']|default([])) + (groups['all_vpns']|default([]))
register: vless_user_pass_dict
# no_log: true
notify:
- restart_xray
- name: "vmess user management"
xray:
users: "{{ all_users|default([]) + vmess_users|default([]) }}"
protocol: vmess
address: "{{ ansible_default_ipv4.interface|default(ansible_all_ipv4_addresses[0]) }}"
service_port: "{{ vless_port|default(4437) }}"
public_key: "{{ xray_pub_key_b64e.content|b64decode }}"
when: inventory_hostname in (groups['vmess']|default([])) + (groups['all_vpns']|default([]))
register: vmess_user_pass_dict
no_log: true
notify:
- restart_xray
- name: "trojan user management"
xray:
users: "{{ all_users|default([]) + trojan_users|default([]) }}"
protocol: trojan
address: "{{ ansible_default_ipv4.interface|default(ansible_all_ipv4_addresses[0]) }}"
service_port: "{{ vless_port|default(4437) }}"
public_key: "{{ xray_pub_key_b64e.content|b64decode }}"
when: inventory_hostname in (groups['trojan']|default([])) + (groups['all_vpns']|default([]))
register: trojan_user_pass_dict
no_log: true
notify:
- restart_xray
- name: "make temp dir"
ansible.builtin.file:
path: /var/reactance/.temp/
state: directory
- name: "add ocserv user password pair to dict"
ansible.builtin.copy:
content: "{{ (trojan_user_pass_dict['msg']|default({}) | combine(vmess_user_pass_dict['msg']|default({}), vless_user_pass_dict['msg']|default({}), recursive=true, list_merge='append')) | to_json }}"
dest: /var/reactance/.temp/xray_user_pass_dict
|