Skip to content

Commit

Permalink
LinkWarden Convert Postgres to inventory vars
Browse files Browse the repository at this point in the history
  • Loading branch information
owine committed Jan 30, 2024
1 parent bdcf8ff commit 9867ec4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
15 changes: 14 additions & 1 deletion roles/linkwarden/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@

linkwarden_name: linkwarden

################################
# Settings
################################

linkwarden_postgres_name: "{{ linkwarden_name }}-postgres"
linkwarden_postgres_docker_env_username: "{{ linkwarden_name }}"
linkwarden_postgres_docker_env_password: "{{ linkwarden_name }}"
linkwarden_postgres_docker_env_db: "{{ linkwarden_name }}"
linkwarden_postgres_docker_image_tag: "16-alpine"
linkwarden_postgres_docker_image_repo: "postgres"
linkwarden_postgres_paths_folder: "{{ linkwarden_name }}"
linkwarden_postgres_paths_location: "{{ server_appdata_path }}/{{ postgres_paths_folder }}/postgres"

################################
# Paths
################################
Expand Down Expand Up @@ -78,7 +91,7 @@ linkwarden_docker_envs_default:
STORAGE_FOLDER: "/data"
NEXTAUTH_SECRET: "{{ linkwarden_secret_key.stdout }}"
NEXTAUTH_URL: "{{ linkwarden_web_url }}/api/v1/auth"
DATABASE_URL: "postgresql://{{ user.name }}:{{ postgres_docker_env_password }}@{{ linkwarden_name }}-postgres:5432/{{ linkwarden_name }}"
DATABASE_URL: "postgresql://{{ linkwarden_postgres_docker_env_username }}:{{ linkwarden_postgres_docker_env_password }}@{{ linkwarden_postgres_name }}:5432/{{ linkwarden_postgres_docker_env_db }}"
linkwarden_docker_envs_custom: {}
linkwarden_docker_envs: "{{ linkwarden_docker_envs_default
| combine(linkwarden_docker_envs_custom) }}"
Expand Down
13 changes: 8 additions & 5 deletions roles/linkwarden/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
ansible.builtin.include_role:
name: postgres
vars:
postgres_instances: ["{{ linkwarden_name }}-postgres"]
postgres_docker_env_db: "{{ linkwarden_name }}"
postgres_docker_image_tag: "16-alpine"
postgres_paths_folder: "{{ linkwarden_name }}"
postgres_paths_location: "{{ server_appdata_path }}/{{ postgres_paths_folder }}/postgres"
postgres_instances: ["{{ linkwarden_postgres_name }}"]
postgres_docker_env_username: "{{ linkwarden_postgres_docker_env_username }}"
postgres_docker_env_password: "{{ linkwarden_postgres_docker_env_password }}"
postgres_docker_env_db: "{{ linkwarden_postgres_docker_env_db }}"
postgres_docker_image_tag: "{{ linkwarden_postgres_docker_image_tag }}"
postgres_docker_image_repo: "{{ linkwarden_postgres_docker_image_repo }}"
postgres_paths_folder: "{{ linkwarden_postgres_paths_folder }}"
postgres_paths_location: "{{ linkwarden_postgres_paths_location }}"

- name: "Generate Secret Key"
ansible.builtin.shell: "openssl rand -base64 45"
Expand Down

0 comments on commit 9867ec4

Please sign in to comment.