diff --git a/ansible/main.yml b/ansible/main.yml index 3992c84..e38102f 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -35,3 +35,4 @@ roles: - website - statping + - socks-proxy diff --git a/ansible/roles/socks-proxy/files/docker-compose.yml b/ansible/roles/socks-proxy/files/docker-compose.yml new file mode 100644 index 0000000..b6dfdc6 --- /dev/null +++ b/ansible/roles/socks-proxy/files/docker-compose.yml @@ -0,0 +1,12 @@ +version: "2.3" + +services: + 3proxy: + image: riftbit/3proxy:latest + container_name: 3proxy + restart: unless-stopped + ports: + - 1080:1080 + environment: + - PROXY_LOGIN={{ socks_username }} + - PROXY_PASSWORD={{ socks_password }} diff --git a/ansible/roles/socks-proxy/tasks/main.yml b/ansible/roles/socks-proxy/tasks/main.yml new file mode 100644 index 0000000..604f7b6 --- /dev/null +++ b/ansible/roles/socks-proxy/tasks/main.yml @@ -0,0 +1,32 @@ +- name: Include socks variables + include_vars: socks.yml + +- name: Create install directory + file: + path: /opt/3proxy + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + +- name: Install compose file + template: + src: files/docker-compose.yml + dest: /opt/3proxy/docker-compose.yml + mode: "{{ docker_compose_file_mask }}" + owner: "{{ docker_user.name }}" + validate: /usr/bin/docker-compose -f %s config + register: compose_file + become: true + +- name: Cycle container + docker_compose: + project_src: /opt/3proxy + pull: true + remove_orphans: true + remove_volumes: true + state: "{{ item }}" + when: compose_file.changed + loop: + - absent + - present diff --git a/ansible/roles/socks-proxy/vars/socks.yml b/ansible/roles/socks-proxy/vars/socks.yml new file mode 100644 index 0000000..4b3fe15 --- /dev/null +++ b/ansible/roles/socks-proxy/vars/socks.yml @@ -0,0 +1,22 @@ +socks_username: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 64643962636239336632373934363765613731633937393230643366323737343962613136616435 + 3331633461633637396365653663333833613465636266660a346338323562346338363930623164 + 35386230643630306138303762393135343861336364623166613061313436323761373462363762 + 3062393732393338300a393339396534353666366365303363333732393535303531613737663433 + 34326563636437373934313766386431363665646337383862646537643163623939643234373961 + 65316132333331393737336339633837366165373738333130323866346365303631386163656330 + 30666665303437613438326366356165393566346266326263623737626231356133623461343064 + 36623835366165323639373432626664623536383833396338613739336434393563643566303333 + 38343930623835666561626139376662326239383233313830626338336666316236 +socks_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 35346561343164393538643930633434343133353138393565336436653161626332623930326434 + 3133623435363538666431376464356162326266663634640a653835663333366333373739396361 + 32306231656264633737353363346363356139323631306136393231383830366563643730313162 + 6334336338386230330a373464396430323465656666626436633832323236633065393065353030 + 39356333646663663630353565653734663663613131323734373765316662316564616666336562 + 64336531316338383938623637346536323961353264313363323137626533356639326633633266 + 34393336346461333364663234303663333939386133383166663261393433323632653034303634 + 63376665333064393933326164346634616232646361313639396330326365366435343066656566 + 61303764616661343563396262616339343335633963623565353934346561313534