Browse Source

Add preliminary emus role

Colin Powell 2 years ago
parent
commit
ea69a0c01a

+ 14 - 0
ansible/roles/emacs/tasks/main.yml

@@ -0,0 +1,14 @@
+---
+- name: DBus and Avahi packages installed
+  community.general.pkgng:
+    name: "git-tiny emacs findutils syncthing ripgrep fd-find stow"
+    state: latest
+
+- name: Doom config fetched
+  shell: git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.emacs.d
+
+- name: Doom config installed
+  shell: /root/.emacs.d/bin/doom install
+
+- name: Dotfiles cloned
+  shell: git clone https://code.unbl.ink/secstate/dotfiles .dotfiles

+ 62 - 0
ansible/roles/emus/tasks/main.yml

@@ -0,0 +1,62 @@
+---
+- name: Dependencies installed
+  community.general.pkgng:
+    name: py38-pip,py38-pillow,git-tiny,py38-psycopg2,nginx
+    state: latest
+
+- name: Source folder exists
+  file:
+    path: /usr/local/src
+    owner: root
+    mode: 0755
+    state: directory
+
+- name: Emus source @ master
+  git:
+    repo: "https://code.unbl.ink/secstate/emus"
+    dest: /usr/local/src/emus
+    update: yes
+    force: yes
+  tags:
+    - update
+
+- 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: Poetry installed
+  pip:
+    name: poetry
+
+- name: Emus dependecies installed
+  command: poetry install
+  args:
+    chdir: /usr/local/src/emus
+
+
+- name: Emus migrations up to date
+  command: poetry run python manage.py migrate
+  args:
+    chdir: /usr/local/src/emus
+
+- name: Emus migrations up to date
+  command: poetry run python manage.py 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

+ 7 - 0
ansible/roles/emus/templates/immortaly.yml.j2

@@ -0,0 +1,7 @@
+cmd: poetry run gunicorn
+log:
+    file: /var/log/emus.log
+    age: 86400 # log 1 day
+    num: 7 # keep 7 files
+    size: 1 # size of file 1MB
+wait: 1