diff options
author | clarkzjw <[email protected]> | 2022-12-12 10:58:43 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2022-12-12 10:58:43 -0800 |
commit | 16145f12002624f098be35b4108d38d9d23146df (patch) | |
tree | 96e15ffd3d4bbd2eb36fae0720d47487c8291c2d | |
parent | fe8cd972b5b72b8983c3f7fd6e7153c78ed278ea (diff) | |
download | jinwei.me-16145f12002624f098be35b4108d38d9d23146df.tar.gz |
config: start rss stack using docker-compose
-rw-r--r-- | rss.jinwei.me/config/requirements.yaml | 2 | ||||
-rw-r--r-- | rss.jinwei.me/config/roles/rss/tasks/main.yaml | 32 | ||||
-rw-r--r-- | rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 | 1 |
3 files changed, 35 insertions, 0 deletions
diff --git a/rss.jinwei.me/config/requirements.yaml b/rss.jinwei.me/config/requirements.yaml index 5229cc7..bb232f3 100644 --- a/rss.jinwei.me/config/requirements.yaml +++ b/rss.jinwei.me/config/requirements.yaml | |||
@@ -8,3 +8,5 @@ collections: | |||
8 | version: 1.3.0 | 8 | version: 1.3.0 |
9 | - name: community.docker | 9 | - name: community.docker |
10 | version: 3.2.1 | 10 | version: 3.2.1 |
11 | - name: community.mysql | ||
12 | version: 3.5.1 | ||
diff --git a/rss.jinwei.me/config/roles/rss/tasks/main.yaml b/rss.jinwei.me/config/roles/rss/tasks/main.yaml index 16091cb..070c48e 100644 --- a/rss.jinwei.me/config/roles/rss/tasks/main.yaml +++ b/rss.jinwei.me/config/roles/rss/tasks/main.yaml | |||
@@ -1,3 +1,35 @@ | |||
1 | - name: install packages | ||
2 | apt: | ||
3 | name: | ||
4 | - python3-pymysql | ||
5 | update_cache: true | ||
6 | |||
7 | - name: create ttrss database if not exists | ||
8 | community.mysql.mysql_db: | ||
9 | login_host: "{{ lookup('aws_ssm', '/jinwei-me/mysql/host') }}" | ||
10 | login_port: "{{ lookup('aws_ssm', '/jinwei-me/mysql/port') }}" | ||
11 | login_user: "{{ lookup('aws_ssm', '/jinwei-me/mysql/username') }}" | ||
12 | login_password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/password') }}" | ||
13 | name: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_name') }}" | ||
14 | state: present | ||
15 | |||
16 | - name: create ttrss database user | ||
17 | community.mysql.mysql_user: | ||
18 | login_host: "{{ lookup('aws_ssm', '/jinwei-me/mysql/host') }}" | ||
19 | login_port: "{{ lookup('aws_ssm', '/jinwei-me/mysql/port') }}" | ||
20 | login_user: "{{ lookup('aws_ssm', '/jinwei-me/mysql/username') }}" | ||
21 | login_password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/password') }}" | ||
22 | name: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_user') }}" | ||
23 | host: "*" | ||
24 | password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_password') }}" | ||
25 | priv: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_name') }}.*:ALL" | ||
26 | state: present | ||
27 | |||
28 | - name: create rss_home | ||
29 | file: | ||
30 | path: "{{ rss_home }}" | ||
31 | state: directory | ||
32 | |||
1 | - name: render Dockerfile.rssbot | 33 | - name: render Dockerfile.rssbot |
2 | template: | 34 | template: |
3 | src: Dockerfile.rssbot.j2 | 35 | src: Dockerfile.rssbot.j2 |
diff --git a/rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 b/rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 index fd556dc..99da1a9 100644 --- a/rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 +++ b/rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 | |||
@@ -25,6 +25,7 @@ services: | |||
25 | 25 | ||
26 | rssbot: | 26 | rssbot: |
27 | build: | 27 | build: |
28 | context: . | ||
28 | dockerfile: ./Dockerfile.rssbot | 29 | dockerfile: ./Dockerfile.rssbot |
29 | container_name: ttrss_rssbot | 30 | container_name: ttrss_rssbot |
30 | restart: always | 31 | restart: always |