aboutsummaryrefslogtreecommitdiffstats
path: root/roles/shadowsocks/tasks/main.yml
blob: 414ddee91a4cf2b009c5d52b8c0503707b0b81d5 (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
---
- name: install shadowsocks-libev
  pkgng:
    name: shadowsocks-libev
    state: present

- name: setup configuration file
  template:
    src: config.json.j2
    dest: /usr/local/etc/shadowsocks-libev/config.json
    mode: 0640
  notify: restart-shadowsocks

- name: enable and start service
  command: rcenable shadowsocks-libev

- name: show client-side config
  vars:
    config: |
      "{"
          "server": "{{ ansible_ssh_host }}",
          "server_port": {{ shadowsocks.port }},
          "local_port": 1080,
          "password": "{{ shadowsocks.password }}",
          "method": "{{ shadowsocks.method }}",
          "timeout": 600,
          "fast_open": true,
          "reuse_port": true,
          "no_delay": true
      "}"
  debug:
    msg: "{{ config.split('\n') }}"