diff options
author | clarkzjw <[email protected]> | 2023-01-01 21:42:54 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2023-01-01 21:42:54 -0800 |
commit | 946f9ba5625ae8100e7ab5de3cfabd9439e66a71 (patch) | |
tree | bb98625a2fde12d31bfe12af83a5ef5a48cbd57e /bean.jinwei.me/config/roles/beancount | |
parent | 246d8da4b825d6a622a4d9efbcf7f0d3b3724222 (diff) | |
parent | 55542d3204314c170c123dc066f93b4c8f9ac4bc (diff) | |
download | jinwei.me-946f9ba5625ae8100e7ab5de3cfabd9439e66a71.tar.gz |
Merge pull request #3 from clarkzjw/bean.jinwei.me
config: add beancount
Diffstat (limited to 'bean.jinwei.me/config/roles/beancount')
3 files changed, 50 insertions, 0 deletions
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 @@ | |||
1 | bean_image: clarkzjw/ledger | ||
2 | bean_image_tag: master | ||
3 | 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 @@ | |||
1 | - name: login to docker hub | ||
2 | community.docker.docker_login: | ||
3 | username: "{{ lookup('aws_ssm', '/jinwei-me/docker/username') }}" | ||
4 | password: "{{ lookup('aws_ssm', '/jinwei-me/docker/token') }}" | ||
5 | |||
6 | - name: pull ledger Docker image | ||
7 | community.docker.docker_image: | ||
8 | name: "{{ bean_image }}:{{ bean_image_tag }}" | ||
9 | source: pull | ||
10 | |||
11 | - name: Create directory | ||
12 | file: | ||
13 | path: "{{ bean_home }}" | ||
14 | state: directory | ||
15 | mode: '0755' | ||
16 | |||
17 | - name: render config file | ||
18 | template: | ||
19 | src: docker-compose.yaml.j2 | ||
20 | dest: "{{ bean_home }}/docker-compose.yaml" | ||
21 | mode: 0644 | ||
22 | |||
23 | - name: start ledger container using docker-compose | ||
24 | community.docker.docker_compose: | ||
25 | project_name: ledger | ||
26 | project_src: "{{ bean_home }}" | ||
27 | register: output | ||
28 | |||
29 | #- name: setup cronjob for additional backup | ||
30 | # cron: | ||
31 | # cron_file: wordpress_backup_hetzner | ||
32 | # user: root | ||
33 | # state: present | ||
34 | # name: "wordpress backup" | ||
35 | # minute: "0" | ||
36 | # hour: "0" | ||
37 | # day: "*" | ||
38 | # 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 @@ | |||
1 | version: '3' | ||
2 | services: | ||
3 | ledger: | ||
4 | image: {{ bean_image }}:{{ bean_image_tag }} | ||
5 | container_name: ledger | ||
6 | restart: always | ||
7 | ports: | ||
8 | - 30082:8081 | ||
9 | - 30083:8080 | ||