From 81d2be3b74d500eab7a3c9ec88030e50a1c6bb01 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 9 Feb 2020 15:48:22 +0000 Subject: [PATCH] Install `todoist-github` --- .../files/todoist-github/docker-compose.yml | 10 ++++++ ansible/roles/docker/tasks/main.yml | 3 ++ ansible/roles/docker/tasks/todoist-github.yml | 34 +++++++++++++++++++ ansible/roles/docker/vars/todoist-github.yml | 17 ++++++++++ 4 files changed, 64 insertions(+) create mode 100644 ansible/roles/docker/files/todoist-github/docker-compose.yml create mode 100644 ansible/roles/docker/tasks/todoist-github.yml create mode 100644 ansible/roles/docker/vars/todoist-github.yml diff --git a/ansible/roles/docker/files/todoist-github/docker-compose.yml b/ansible/roles/docker/files/todoist-github/docker-compose.yml new file mode 100644 index 0000000..188449d --- /dev/null +++ b/ansible/roles/docker/files/todoist-github/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' +services: + todoist-github: + image: theorangeone/todoist-github:latest + container_name: todoist-github + restart: unless-stopped + command: python3 -m todoist_github --interval 900 + environment: + - TODOIST_TOKEN={{ todoist_github.todoist_token }} + - GITHUB_TOKEN={{ todoist_github.github_token }} diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml index eee034d..b6cd25f 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -54,3 +54,6 @@ - name: Install nextcloud include: nextcloud.yml + +- name: Install todoist-github + include: todoist-github.yml diff --git a/ansible/roles/docker/tasks/todoist-github.yml b/ansible/roles/docker/tasks/todoist-github.yml new file mode 100644 index 0000000..30df961 --- /dev/null +++ b/ansible/roles/docker/tasks/todoist-github.yml @@ -0,0 +1,34 @@ +- name: Include todoist-github variables + include_vars: todoist-github.yml + +- name: Create todoist-github directory + file: + path: '/opt/todoist-github' + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + become_user: root + +- name: Install todoist-github compose file + template: + src: files/todoist-github/docker-compose.yml + dest: "/opt/todoist-github/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 todoist-github container + docker_compose: + project_src: /opt/todoist-github + pull: true + remove_orphans: true + remove_volumes: true + state: "{{ item }}" + when: compose_file.changed + loop: + - absent + - present diff --git a/ansible/roles/docker/vars/todoist-github.yml b/ansible/roles/docker/vars/todoist-github.yml new file mode 100644 index 0000000..93af225 --- /dev/null +++ b/ansible/roles/docker/vars/todoist-github.yml @@ -0,0 +1,17 @@ +todoist_github: + github_token: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 38636136313732653936343433346331623531306562663731306365346165323331343266303064 + 6565356165333030666130366134383539663631613261350a666537653430356633383339313434 + 37663032333362623035393665633663663065373032616131326239646465616666313838333536 + 3166353065613232630a666539396136306534646164346634373335666164396630646261626261 + 65323163633661326631623363346239373332343037613765313063623338306563616566336136 + 6632616363306462376161323437383137623738366332393033 + todoist_token: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 39373238353963623932643335303864346431346162656464663631656631343335316535396333 + 6462303133643333633930333337666435326461656337370a386130636661656633643666396432 + 32336631393738323633353233333837346634353439363962623832323635633230613830326161 + 3133623634376336640a303733613164306665333638386635353466386638643131343264656138 + 38373236343136323138626436383035616262626434313334353364653563303361326530346565 + 6533313763383333353664303836626332636234336537356635