add mastodon

This commit is contained in:
ace
2021-02-10 02:28:01 +03:00
parent 5c1eafeeec
commit 49249dcd6a
17 changed files with 328 additions and 9 deletions

View File

@ -0,0 +1,17 @@
- name: Import secret.yaml to obtain secrets
include_tasks: secrets.yaml
when:
- mastodon_use_external_db
- postgres_enabled is defined and postgres_enabled
- set_fact:
mastodon_combined_values: "{{ mastodon_default_values | combine(mastodon_values, recursive=true) }}"
- name: Deploy Mastodon
community.kubernetes.helm:
create_namespace: true
release_namespace: "{{ mastodon_namespace | default(namespace) }}"
release_name: "{{ mastodon_name | default('mastodon') }}"
chart_ref: "{{ mastodon_chart | default('ghp/mastodon') }}"
chart_version: "{{ mastodon_version | default(omit) }}"
release_values: "{{ mastodon_combined_values | from_yaml }}"

View File

@ -0,0 +1,25 @@
- block:
- name: Set DB namespace for secret lookup
set_fact:
db_namespace: "{{ mastodon_db_namespace | default(postgres_db_namespace) | default(postgres_namespace) | default(postgres_operator_namespace) | default(namespace) }}"
- name: Set DB secret name for lookup
set_fact:
db_secret_name: "mastodon.{{ postgres_db_team | default(namespace) }}-postgres.credentials.postgresql.acid.zalan.do"
- name: Lookup Mastodon DB secret
set_fact:
mastodon_db_secret: "{{ lookup('k8s', kind='Secret', namespace=db_namespace, resource_name=db_secret_name) }}"
- debug:
msg: "{{ mastodon_db_secret }}"
verbosity: 2
- name: Set Mastodon DB username
set_fact:
mastodon_db_username: "{{ mastodon_db_secret.data.username | b64decode }}"
- name: Set Mastodon DB password
set_fact:
mastodon_db_password: "{{ mastodon_db_secret.data.password | b64decode }}"