From 55542d3204314c170c123dc066f93b4c8f9ac4bc Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Sun, 1 Jan 2023 21:39:42 -0800 Subject: config: add beancount --- .../config/roles/beancount/defaults/main.yaml | 3 ++ .../config/roles/beancount/tasks/main.yaml | 38 ++++++++++++++++++++++ .../beancount/templates/docker-compose.yaml.j2 | 9 +++++ 3 files changed, 50 insertions(+) create mode 100644 bean.jinwei.me/config/roles/beancount/defaults/main.yaml create mode 100644 bean.jinwei.me/config/roles/beancount/tasks/main.yaml create mode 100644 bean.jinwei.me/config/roles/beancount/templates/docker-compose.yaml.j2 (limited to 'bean.jinwei.me/config/roles/beancount') diff --git a/bean.jinwei.me/config/roles/beancount/defaults/main.yaml b/bean.jinwei.me/config/roles/beancount/defaults/main.yaml new file mode 100644 index 0000000..b9a36ee --- /dev/null +++ b/bean.jinwei.me/config/roles/beancount/defaults/main.yaml @@ -0,0 +1,3 @@ +bean_image: clarkzjw/ledger +bean_image_tag: master +bean_home: /opt/beancount \ No newline at end of file diff --git a/bean.jinwei.me/config/roles/beancount/tasks/main.yaml b/bean.jinwei.me/config/roles/beancount/tasks/main.yaml new file mode 100644 index 0000000..98bf49d --- /dev/null +++ b/bean.jinwei.me/config/roles/beancount/tasks/main.yaml @@ -0,0 +1,38 @@ +- name: login to docker hub + community.docker.docker_login: + username: "{{ lookup('aws_ssm', '/jinwei-me/docker/username') }}" + password: "{{ lookup('aws_ssm', '/jinwei-me/docker/token') }}" + +- name: pull ledger Docker image + community.docker.docker_image: + name: "{{ bean_image }}:{{ bean_image_tag }}" + source: pull + +- name: Create directory + file: + path: "{{ bean_home }}" + state: directory + mode: '0755' + +- name: render config file + template: + src: docker-compose.yaml.j2 + dest: "{{ bean_home }}/docker-compose.yaml" + mode: 0644 + +- name: start ledger container using docker-compose + community.docker.docker_compose: + project_name: ledger + project_src: "{{ bean_home }}" + register: output + +#- name: setup cronjob for additional backup +# cron: +# cron_file: wordpress_backup_hetzner +# user: root +# state: present +# name: "wordpress backup" +# minute: "0" +# hour: "0" +# day: "*" +# job: "tar caf /tmp/wordpress-$(date -u +\\%Y-\\%m-\\%d-\\%H-\\%M-\\%S\\%Z).tar.xz {{ wordpress_home }} && rsync -azvP /tmp/wordpress-*.tar.xz {{ samba_backup_path }}" diff --git a/bean.jinwei.me/config/roles/beancount/templates/docker-compose.yaml.j2 b/bean.jinwei.me/config/roles/beancount/templates/docker-compose.yaml.j2 new file mode 100644 index 0000000..757e701 --- /dev/null +++ b/bean.jinwei.me/config/roles/beancount/templates/docker-compose.yaml.j2 @@ -0,0 +1,9 @@ +version: '3' +services: + ledger: + image: {{ bean_image }}:{{ bean_image_tag }} + container_name: ledger + restart: always + ports: + - 30082:8081 + - 30083:8080 -- cgit v1.2.3