1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-28 09:41:20 +00:00
dockerfiles/shadowsocks/playbook.yml

60 lines
1.3 KiB
YAML
Raw Normal View History

2015-08-29 03:26:55 +00:00
---
2015-09-11 10:21:13 +00:00
- name: shadowsocks-libev deployment for ubuntu/debian
hosts: vps
gather_facts: yes
2015-08-29 03:26:55 +00:00
vars:
dns_addr: 8.8.8.8
method: chacha20
password: '******'
port: 8388
tasks:
2015-09-11 10:21:13 +00:00
- fail: msg='ensure os is debian/ubuntu'
when: 'ansible_distribution not in ["Debian", "Ubuntu"]'
2015-08-29 03:26:55 +00:00
- name: ensure docker is installed
2015-09-11 10:21:13 +00:00
shell: 'curl -sSL https://get.docker.com | sh'
args:
creates: /usr/bin/docker
2015-08-29 03:26:55 +00:00
2015-08-31 00:11:03 +00:00
- name: ensure docker is running
service:
name: docker
state: started
2015-08-29 03:26:55 +00: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 10:21:13 +00:00
name: shadowsocks_shadowsocks_1
2015-08-29 03:26:55 +00: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 00:11:03 +00:00
- name: wait for shadowsocks
wait_for:
2015-09-11 10:21:13 +00:00
host: "{{ansible_ssh_host|d(inventory_hostname)}}"
2015-08-31 00:11:03 +00:00
port: "{{port}}"
delay: 5