summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2024-06-12 17:05:02 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2024-06-12 17:05:02 +0200
commit3a69fc47718d6c366b1ba1e797eb6c0d7036c129 (patch)
tree2f7a4df9d6cf37a394254914d92cd6db8a70c694
parent80b9b2f3af4ee9ffd2b629455a3bd8955372939c (diff)
add ansible depolyment script
-rw-r--r--.gitignore2
-rw-r--r--depoly.yml37
2 files changed, 39 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 1094ba8..0247f3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,5 @@ dist/
jwebmail.prod.toml
jwebmail_pb2.py
jwebmail_pb2.pyi
+inventory.ini
+script/extract
diff --git a/depoly.yml b/depoly.yml
new file mode 100644
index 0000000..e55d2bb
--- /dev/null
+++ b/depoly.yml
@@ -0,0 +1,37 @@
+- name: Depoly jwebmail
+ hosts: myhosts
+
+ vars:
+ wheels: "{{ lookup('ansible.builtin.fileglob', 'dist/*.whl', wantlist=True)|map('basename') }}"
+ latest_version: "{{ wheels|map('split', '-')|map(attribute='1')|community.general.version_sort|last }}"
+
+ tasks:
+ - name: Info
+ ansible.builtin.debug:
+ var: latest_version
+ - name: Copy
+ ansible.builtin.copy:
+ src: "dist/jwebmail-{{ latest_version }}-py3-none-any.whl"
+ dest: "jwebmail-{{ latest_version }}-py3-none-any.whl"
+ - name: Update
+ ansible.builtin.pip:
+ extra_args: "--target /usr/local/jwebmail --upgrade"
+ name: "file:///home/jannis/jwebmail-{{ latest_version }}-py3-none-any.whl"
+ become: true
+ - name: Scripts
+ ansible.builtin.copy:
+ src: "script/moveto3.py"
+ dest: "/usr/local/jwebmail/bin/moveto3.py"
+ mode: "0755"
+ become: true
+ - name: Extract
+ ansible.builtin.copy:
+ src: "script/extract"
+ dest: "/usr/local/bin/jwebmail-extract"
+ mode: "0755"
+ become: true
+ - name: Restart
+ ansible.builtin.systemd_service:
+ name: jwebmail
+ state: restarted
+ become: true