diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2021-12-21 20:01:23 +0000 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2021-12-21 20:01:23 +0000 |
commit | 0143cbdcecdd34d90c7e1b2b1f8bcedca83c2c28 (patch) | |
tree | 52c4bf17f7189ad7bdcec192aa08e191a6423b4d /roles/miniflux/tasks | |
parent | 5534eecf07c5feea015d90f6bbe1f7a864758511 (diff) | |
download | rules-0143cbdcecdd34d90c7e1b2b1f8bcedca83c2c28.tar.gz |
roles: Add miniflux for stack0-cld0
Diffstat (limited to 'roles/miniflux/tasks')
-rw-r--r-- | roles/miniflux/tasks/main.yml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/roles/miniflux/tasks/main.yml b/roles/miniflux/tasks/main.yml new file mode 100644 index 0000000..3964835 --- /dev/null +++ b/roles/miniflux/tasks/main.yml @@ -0,0 +1,47 @@ +- name: install miniflux + package: + name: miniflux + state: present + +- name: include postgres user + include_role: + name: postgres + tasks_from: create_user + vars: + postgres_db_user: "{{ miniflux_db_user }}" + +- name: include postgres db + include_role: + name: postgres + tasks_from: create_db + vars: + postgres_db_user: "{{ miniflux_db_user }}" + postgres_db_name: "{{ miniflux_db_name}}{{ item }}" + loop: + - "" + - 2 + +- name: enable hstore extension for postgres + command: psql -U postgres miniflux -c "create extension hstore" + register: result + failed_when: result.rc != 0 and "already exists" not in result.stderr + +- name: generate configuration + template: + src: miniflux.conf.j2 + dest: /etc/miniflux.conf + owner: "{{ miniflux_user }}" + owner: "{{ miniflux_group }}" + mode: 0640 + +- name: run postgres migrations + shell: | + psql -U postgres -c "ALTER USER miniflux WITH SUPERUSER" + miniflux -c /etc/miniflux.conf -migrate + psql -U postgres -c "ALTER USER miniflux WITH NOSUPERUSER" + +- name: restart and enable miniflux + service: + name: miniflux + state: restarted + enabled: true |