---
- name: Dependencies installed
  community.general.pkgng:
    name: py39-pip,py39-cryptography,jpeg-turbo,tiff,webp,lcms2,freetype2,cairo,pango,rust,postgresql13-client
    state: latest

- name: Static files folder exists
  file:
    path: /var/www/emus/static/
    owner: root
    mode: 0755
    state: directory

- name: Media files folder exists
  file:
    path: /var/www/emus/media/
    owner: root
    mode: 0755
    state: directory

- name: Emus conf file installed
  template:
    src: emus.conf.j2
    dest: /usr/local/etc/emus.conf
    owner: root
    mode: 0600

- name: Skyscraper conf file installed template:
    src: skyscraper.ini.j2
    dest: /usr/local/etc/skyscraper.ini
    owner: root
    mode: 0600

- name: Emus Web installed
  shell: "pip install emus_web"

- name: Emus migrations up to date
  command: emus migrate

- name: Emus migrations up to date
  command: emus collectstatic --noinput
  args:
    chdir: /usr/local/src/emus

- name: Emus immortal file installed
  template:
    src: emus.yml.j2
    dest: /usr/local/etc/immortal/emus.yml
    owner: root
    mode: 0600
  notify: Immortal restarted
