aboutsummaryrefslogblamecommitdiffstats
path: root/roles/miniflux/tasks/main.yml
blob: 2e8003c06341efdc5812b4c195adfeddcd28b2e8 (plain) (tree)
1
2
3
4
5
6
7
8
9

   
                        
                          



                             
                               





                                              
                               



                                              
                                                        



        


                                                                     



                                                                       
                           


                                
                
 

                                                        




                                                              
                          


                    
---

- name: install miniflux
  ansible.builtin.package:
    name: miniflux
    state: present

- name: include postgres user
  ansible.builtin.include_role:
    name: postgres
    tasks_from: create_user
  vars:
    postgres_db_user: "{{ miniflux_db_user }}"

- name: include postgres db
  ansible.builtin.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  # noqa: no-changed-when
  ansible.builtin.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
  ansible.builtin.template:
    src: miniflux.conf.j2
    dest: /etc/miniflux.conf
    owner: "{{ miniflux_user }}"
    mode: "0640"

- name: run postgres migrations  # noqa: no-changed-when
  ansible.builtin.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
  ansible.builtin.service:
    name: miniflux
    state: restarted
    enabled: true
remember that computers suck.