diff --git a/playbook.yml b/playbook.yml index 6cebec86..ec9c608f 100644 --- a/playbook.yml +++ b/playbook.yml @@ -205,6 +205,14 @@ vars: domain: matomo.{{top_domain}} http_port: 8018 +- name: setup listmonk + hosts: listmonk + become: true + roles: + - role: docker-listmonk + vars: + domain: listmonk.{{top_domain}} + http_port: 8019 - name: setup akaunting hosts hosts: akaunting become: true diff --git a/roles/docker-listmonk/README.md b/roles/docker-listmonk/README.md new file mode 100644 index 00000000..66450eaa --- /dev/null +++ b/roles/docker-listmonk/README.md @@ -0,0 +1,5 @@ +# Role Docker Listmonk + +## Further Information +- https://listmonk.app/docs/installation/ +- https://github.com/knadh/listmonk/ \ No newline at end of file diff --git a/roles/docker-listmonk/meta/main.yml b/roles/docker-listmonk/meta/main.yml index f25ef891..d3606e63 100644 --- a/roles/docker-listmonk/meta/main.yml +++ b/roles/docker-listmonk/meta/main.yml @@ -1,2 +1,2 @@ dependencies: -- docker-reverse-proxy +- nginx-docker-reverse-proxy diff --git a/roles/docker-listmonk/tasks/main.yml b/roles/docker-listmonk/tasks/main.yml index 85364bf4..eaf7eea6 100644 --- a/roles/docker-listmonk/tasks/main.yml +++ b/roles/docker-listmonk/tasks/main.yml @@ -4,18 +4,24 @@ - name: configure {{domain}}.conf template: - src: "roles/docker-reverse-proxy/templates/domain.conf.j2" + src: "roles/nginx-docker-reverse-proxy/templates/domain.conf.j2" dest: "/etc/nginx/conf.d/{{domain}}.conf" notify: restart nginx -- name: "create {{path_docker_compose_files}}listmonk/" +- name: "create {{path_docker_compose_folder}}" file: - path: "{{path_docker_compose_files}}listmonk/" + path: "{{path_docker_compose_folder}}" state: directory mode: 0755 - name: add docker-compose.yml template: src: "docker-compose.yml.j2" - dest: "{{path_docker_compose_files}}listmonk/docker-compose.yml" + dest: "{{path_docker_compose_folder}}docker-compose.yml" notify: recreate listmonk + +- name: add config.toml + template: + src: "config.toml.j2" + dest: "{{path_docker_compose_folder}}config.toml" + notify: recreate listmonk \ No newline at end of file diff --git a/roles/docker-listmonk/templates/config.toml b/roles/docker-listmonk/templates/config.toml.j2 similarity index 91% rename from roles/docker-listmonk/templates/config.toml rename to roles/docker-listmonk/templates/config.toml.j2 index b504f907..1bae4820 100644 --- a/roles/docker-listmonk/templates/config.toml +++ b/roles/docker-listmonk/templates/config.toml.j2 @@ -3,7 +3,7 @@ # of localhost will only listen to connections from the current machine. To # listen on all interfaces use '0.0.0.0'. To listen on the default web address # port, use port 80 (this will require running with elevated permissions). -address = "localhost:9000" +address = "0.0.0.0:9000" # BasicAuth authentication for the admin dashboard. This will eventually # be replaced with a better multi-user, role-based authentication system. @@ -14,10 +14,10 @@ admin_password = "listmonk" # Database. [db] -host = "localhost" +host = "listmonk_db" port = 5432 user = "listmonk" -password = "listmonk" +password = "{{listmonk_database_password}}" # Ensure that this database has been created in Postgres. database = "listmonk" diff --git a/roles/docker-listmonk/templates/docker-compose.yml.j2 b/roles/docker-listmonk/templates/docker-compose.yml.j2 index a50c2655..e1cbbc3e 100644 --- a/roles/docker-listmonk/templates/docker-compose.yml.j2 +++ b/roles/docker-listmonk/templates/docker-compose.yml.j2 @@ -8,20 +8,20 @@ x-app-defaults: &app-defaults restart: unless-stopped image: listmonk/listmonk:latest ports: - - "9000:9000" + - "127.0.0.1:{{http_port}}:9000" networks: - listmonk environment: - TZ=Etc/UTC x-db-defaults: &db-defaults - image: postgres:13 + image: postgres:13-alpine ports: - "9432:5432" networks: - listmonk environment: - - POSTGRES_PASSWORD=listmonk + - POSTGRES_PASSWORD={{listmonk_database_password}} - POSTGRES_USER=listmonk - POSTGRES_DB=listmonk restart: unless-stopped @@ -47,6 +47,7 @@ services: - db volumes: - ./config.toml:/listmonk/config.toml + networks: listmonk: diff --git a/roles/docker-listmonk/vars/main.yml b/roles/docker-listmonk/vars/main.yml new file mode 100644 index 00000000..da09a09b --- /dev/null +++ b/roles/docker-listmonk/vars/main.yml @@ -0,0 +1 @@ +path_docker_compose_folder: "{{path_docker_compose_files}}listmonk/"