Selaa lähdekoodia

[bookwyrm] Add initial role

Colin Powell 2 vuotta sitten
vanhempi
commit
daa09ff31d
1 muutettua tiedostoa jossa 50 lisäystä ja 0 poistoa
  1. 50 0
      ansible/roles/bookwyrm/tasks/main.yml

+ 50 - 0
ansible/roles/bookwyrm/tasks/main.yml

@@ -0,0 +1,50 @@
+---
+- name: Dependencies installed
+  # We install xmlsec and cairocffi using pkg because python-Levenshtein is tricky to install on FreeBSD
+  community.general.pkgng:
+    name: git-tiny,py38-pip,jpeg-turbo,tiff,webp,lcms2,freetype2,cairo,pango,gmake,libxml2,libxslt,py38-psycopg2,py38-xmlsec,py38-cairocffi,py38-sqlite3,bash
+    state: latest
+
+- name: Bookwyrm source deployed
+  git:
+    repo: "https://github.com/bookwyrm-social/bookwyrm.git"
+    dest: /usr/local/src/bookwyrm
+    update: yes
+  ignore_errors: true
+  tags:
+    - deploy
+
+- name: Requirements up to date
+  pip:
+    requirements: /usr/local/src/bookwyrm/requirements.txt
+    executable: pip
+  tags:
+    - deploy
+
+- name: Bookwyrm migrations up to date
+  command: bash -lc "direnv exec /usr/local/src/bookwyrm /usr/local/bin/python3.8 /usr/local/src/bookwyrm/manage.py migrate"
+  tags:
+    - deploy
+
+- name: Bookwyrm frontend files up to date
+  command: bash -lc "direnv exec /usr/local/src/bookwyrm /usr/local/bin/python3.8 manage.py collectstatic --noinput
+  args:
+    chdir: "/usr/local/src/bookwyrm"
+  tags:
+    - deploy
+
+- name: Bookwyrm uvicorn immortal file installed
+  template:
+    src: uvicorn-immortal.yml.j2
+    dest: /usr/local/etc/immortal/bookwyrm-uvicorn.yml
+    owner: root
+    mode: 0644
+  notify: Immortal restarted
+
+- name: Bookwyrm celery immortal file installed
+  template:
+    src: celery-immortal.yml.j2
+    dest: /usr/local/etc/immortal/bookwyrm-celery.yml
+    owner: root
+    mode: 0644
+  notify: Immortal restarted