From 72748de2b0c313a7e3123994ed19bde9e6d6de69 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 1 Sep 2022 20:33:19 +0200 Subject: [PATCH] implemented first draft of versioned akaunting --- roles/docker-akaunting/readme.md | 3 +++ roles/docker-akaunting/tasks/main.yml | 27 ++++++++++++++++++++++++--- roles/docker-akaunting/vars/main.yml | 1 + 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 roles/docker-akaunting/vars/main.yml diff --git a/roles/docker-akaunting/readme.md b/roles/docker-akaunting/readme.md index dff736e2..c776183d 100644 --- a/roles/docker-akaunting/readme.md +++ b/roles/docker-akaunting/readme.md @@ -88,6 +88,9 @@ bash docker-volume-recover.sh akaunting_akaunting-db ${machine_id:0:64} "$backup ``` +## todo +- implement build when new akaunting version is set + ## Further information - https://github.com/akaunting/docker - https://akaunting.com/forum/discussion/installation-update/updating-to-300-failed-cant-manually-update-either diff --git a/roles/docker-akaunting/tasks/main.yml b/roles/docker-akaunting/tasks/main.yml index 3d388abc..f06add75 100644 --- a/roles/docker-akaunting/tasks/main.yml +++ b/roles/docker-akaunting/tasks/main.yml @@ -6,16 +6,37 @@ template: src=roles/native-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf notify: restart nginx +- name: register directory + stat: + path: "{{docker_compose_akaunting_path}}" + register: docker_compose_akaunting_path_register + +- name: checkout repository + ansible.builtin.shell: git checkout . + become: true + args: + chdir: "{{docker_compose_akaunting_path}}" + when: docker_compose_akaunting_path_register.stat.exists + become: true + - name: pull docker repository git: repo: "https://github.com/akaunting/docker.git" - dest: "/home/administrator/docker-compose/akaunting/" + dest: "{{docker_compose_akaunting_path}}" update: yes + notify: setup akaunting + become: true + +- name: set akaunting version + ansible.builtin.shell: find . -type f -exec sed -i 's/akaunting:latest/akaunting:{{akaunting_version}}/' {} + && find . -type f -exec sed -i 's/version=latest/version={{akaunting_version}}/' {} + + become: true + args: + chdir: "{{docker_compose_akaunting_path}}" - name: configure db.env - template: src=db.env.j2 dest=/home/administrator/docker-compose/akaunting/env/db.env + template: src=db.env.j2 dest={{docker_compose_akaunting_path}}/env/db.env notify: setup akaunting - name: configure run.env - template: src=run.env.j2 dest=/home/administrator/docker-compose/akaunting/env/run.env + template: src=run.env.j2 dest={{docker_compose_akaunting_path}}/env/run.env notify: setup akaunting diff --git a/roles/docker-akaunting/vars/main.yml b/roles/docker-akaunting/vars/main.yml new file mode 100644 index 00000000..70dc32af --- /dev/null +++ b/roles/docker-akaunting/vars/main.yml @@ -0,0 +1 @@ +docker_compose_akaunting_path: "/home/administrator/docker-compose/akaunting/"