From dd956450dc5f97511d9fa5f37b460afea5e32a08 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 8 Mar 2020 15:13:44 +0000 Subject: [PATCH] Start folding --- .../files/folding-at-home/docker-compose.yml | 17 ++++++++++ .../roles/docker/tasks/folding-at-home.yml | 34 +++++++++++++++++++ ansible/roles/docker/tasks/main.yml | 3 ++ ansible/roles/docker/vars/folding-at-home.yml | 8 +++++ 4 files changed, 62 insertions(+) create mode 100644 ansible/roles/docker/files/folding-at-home/docker-compose.yml create mode 100644 ansible/roles/docker/tasks/folding-at-home.yml create mode 100644 ansible/roles/docker/vars/folding-at-home.yml diff --git a/ansible/roles/docker/files/folding-at-home/docker-compose.yml b/ansible/roles/docker/files/folding-at-home/docker-compose.yml new file mode 100644 index 0000000..8c6401c --- /dev/null +++ b/ansible/roles/docker/files/folding-at-home/docker-compose.yml @@ -0,0 +1,17 @@ +version: "3" + +services: + folding-at-home: + image: yurinnick/folding-at-home:latest + container_name: folding-at-home + command: --allow 0/0 --web-allow 0/0 --power light --cpu-usage 35 + environment: + - USER=TheOrangeOne + - TEAM=223518 + - PASSKEY={{ foh_token }} + - ENABLE_GPU=false + - ENABLE_SMP=true + ports: + - 7396:7396 + - 36330:36330 + restart: unless-stopped diff --git a/ansible/roles/docker/tasks/folding-at-home.yml b/ansible/roles/docker/tasks/folding-at-home.yml new file mode 100644 index 0000000..114d87d --- /dev/null +++ b/ansible/roles/docker/tasks/folding-at-home.yml @@ -0,0 +1,34 @@ +- name: Include foh variables + include_vars: folding-at-home.yml + +- name: Create foh directory + file: + path: '/opt/foh' + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + become_user: root + +- name: Install foh compose file + template: + src: files/folding-at-home/docker-compose.yml + dest: "/opt/foh/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 + become_user: root + +- name: Cycle foh container + docker_compose: + project_src: /opt/foh + pull: true + remove_orphans: true + remove_volumes: true + state: "{{ item }}" + when: compose_file.changed + loop: + - absent + - present diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml index dd0e524..a7267bc 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -60,3 +60,6 @@ - name: Install duplicati include: duplicati.yml + +- name: Install folding-at-home + include: folding-at-home.yml diff --git a/ansible/roles/docker/vars/folding-at-home.yml b/ansible/roles/docker/vars/folding-at-home.yml new file mode 100644 index 0000000..41e15b7 --- /dev/null +++ b/ansible/roles/docker/vars/folding-at-home.yml @@ -0,0 +1,8 @@ +foh_token: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 38393937366266353162336339643261613138616135643163393464353339653761623833303334 + 3136633535616165383561623863346630326264663564360a613733313835646333373464313033 + 65303338646665346532653232626535363665636132333065343133636332383663393034373863 + 3437626337666539610a656264653135656566313133383935396233313366633961333637373363 + 30326130623936383437636465393262633735656563323337666235373834363833396336343866 + 6362626138313266633032633466386461643737336266623363