From 3a69fc47718d6c366b1ba1e797eb6c0d7036c129 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Wed, 12 Jun 2024 17:05:02 +0200 Subject: add ansible depolyment script --- .gitignore | 2 ++ depoly.yml | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 depoly.yml 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 -- cgit v1.2.3