aboutsummaryrefslogtreecommitdiffstats
path: root/roles/miniflux/tasks/main.yml
blob: 396483512f1a825473c9b2cb979021bcf153fbaa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
remember that computers suck.