1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-23 01:39:27 +02:00
dockerfiles/shadowsocks/playbook.yml

60 lines
1.3 KiB
YAML
Raw Normal View History

2015-08-29 05:26:55 +02:00
---
2015-09-11 12:21:13 +02:00
- name: shadowsocks-libev deployment for ubuntu/debian
hosts: vps
gather_facts: yes
2015-08-29 05:26:55 +02:00
vars:
dns_addr: 8.8.8.8
method: chacha20
password: '******'
port: 8388
tasks:
2015-09-11 12:21:13 +02:00
- fail: msg='ensure os is debian/ubuntu'
when: 'ansible_distribution not in ["Debian", "Ubuntu"]'
2015-08-29 05:26:55 +02:00
- name: ensure docker is installed
2015-09-11 12:21:13 +02:00
shell: 'curl -sSL https://get.docker.com | sh'
args:
creates: /usr/bin/docker
2015-08-29 05:26:55 +02:00
2015-08-31 02:11:03 +02:00
- name: ensure docker is running
service:
name: docker
state: started
2015-08-29 05:26:55 +02:00
- name: ensure pip is installed
shell: 'curl -sSL https://bootstrap.pypa.io/get-pip.py | python2'
args:
creates: /usr/local/bin/pip2
- name: ensure docker-py is installed
pip:
name: docker-py
executable: pip2
state: present
- name: ensure shadowsocks is started
docker:
2015-09-11 12:21:13 +02:00
name: shadowsocks_shadowsocks_1
2015-08-29 05:26:55 +02:00
image: vimagick/shadowsocks-libev
ports:
- "{{port}}:8388"
env:
DNS_ADDR: "{{dns_addr}}"
METHOD: "{{method}}"
PASSWORD: "{{password}}"
restart_policy: always
state: started
2015-08-31 02:11:03 +02:00
- name: wait for shadowsocks
wait_for:
2015-09-11 12:21:13 +02:00
host: "{{ansible_ssh_host|d(inventory_hostname)}}"
2015-08-31 02:11:03 +02:00
port: "{{port}}"
delay: 5