aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-01-01 21:39:42 -0800
committerclarkzjw <[email protected]>2023-01-01 21:39:42 -0800
commit55542d3204314c170c123dc066f93b4c8f9ac4bc (patch)
treebb98625a2fde12d31bfe12af83a5ef5a48cbd57e /bean.jinwei.me/config/roles/beancount
parent999e9e97d314e1702fa455abd9526042ef90b09d (diff)
downloadjinwei.me-55542d3204314c170c123dc066f93b4c8f9ac4bc.tar.gz
config: add beancount
Diffstat (limited to 'bean.jinwei.me/config/roles/beancount')
-rw-r--r--bean.jinwei.me/config/roles/beancount/defaults/main.yaml3
-rw-r--r--bean.jinwei.me/config/roles/beancount/tasks/main.yaml38
-rw-r--r--bean.jinwei.me/config/roles/beancount/templates/docker-compose.yaml.j29
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 @@
1bean_image: clarkzjw/ledger
2bean_image_tag: master
3bean_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 @@
1version: '3'
2services:
3 ledger:
4 image: {{ bean_image }}:{{ bean_image_tag }}
5 container_name: ledger
6 restart: always
7 ports:
8 - 30082:8081
9 - 30083:8080
Powered by cgit v1.2.3 (git 2.41.0)