aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-01-01 21:42:54 -0800
committerGitHub <[email protected]>2023-01-01 21:42:54 -0800
commit946f9ba5625ae8100e7ab5de3cfabd9439e66a71 (patch)
treebb98625a2fde12d31bfe12af83a5ef5a48cbd57e /bean.jinwei.me/config
parent246d8da4b825d6a622a4d9efbcf7f0d3b3724222 (diff)
parent55542d3204314c170c123dc066f93b4c8f9ac4bc (diff)
downloadjinwei.me-946f9ba5625ae8100e7ab5de3cfabd9439e66a71.tar.gz
Merge pull request #3 from clarkzjw/bean.jinwei.me
config: add beancount
Diffstat (limited to 'bean.jinwei.me/config')
-rw-r--r--bean.jinwei.me/config/ansible.cfg14
-rw-r--r--bean.jinwei.me/config/inventory/aws_ec2.yaml7
-rw-r--r--bean.jinwei.me/config/requirements.yaml10
-rw-r--r--bean.jinwei.me/config/role.yaml3
-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
-rw-r--r--bean.jinwei.me/config/site.yaml3
8 files changed, 87 insertions, 0 deletions
diff --git a/bean.jinwei.me/config/ansible.cfg b/bean.jinwei.me/config/ansible.cfg
new file mode 100644
index 0000000..9345045
--- /dev/null
+++ b/bean.jinwei.me/config/ansible.cfg
@@ -0,0 +1,14 @@
1[defaults]
2host_key_checking = False
3transport = ssh
4remote_user = admin
5roles_path = roles
6inventory = inventory
7force_color = True
8interpreter_python = auto_silent
9
10[connection]
11pipelining = True
12
13[privilege_escalation]
14become = True
diff --git a/bean.jinwei.me/config/inventory/aws_ec2.yaml b/bean.jinwei.me/config/inventory/aws_ec2.yaml
new file mode 100644
index 0000000..100d95b
--- /dev/null
+++ b/bean.jinwei.me/config/inventory/aws_ec2.yaml
@@ -0,0 +1,7 @@
1plugin: aws_ec2
2regions:
3 - us-west-2
4hostnames:
5 - tag:Name
6compose:
7 ansible_host: public_ip_address
diff --git a/bean.jinwei.me/config/requirements.yaml b/bean.jinwei.me/config/requirements.yaml
new file mode 100644
index 0000000..5229cc7
--- /dev/null
+++ b/bean.jinwei.me/config/requirements.yaml
@@ -0,0 +1,10 @@
1---
2collections:
3 - name: amazon.aws
4 version: 3.2.0
5 - name: community.general
6 version: 4.7.0
7 - name: ansible.posix
8 version: 1.3.0
9 - name: community.docker
10 version: 3.2.1
diff --git a/bean.jinwei.me/config/role.yaml b/bean.jinwei.me/config/role.yaml
new file mode 100644
index 0000000..ab3fca5
--- /dev/null
+++ b/bean.jinwei.me/config/role.yaml
@@ -0,0 +1,3 @@
1- hosts: "{{ target }}"
2 roles:
3 - role: "{{ role }}"
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
diff --git a/bean.jinwei.me/config/site.yaml b/bean.jinwei.me/config/site.yaml
new file mode 100644
index 0000000..3b450f8
--- /dev/null
+++ b/bean.jinwei.me/config/site.yaml
@@ -0,0 +1,3 @@
1- hosts: jinwei-me
2 roles:
3 - role: beancount
Powered by cgit v1.2.3 (git 2.41.0)