summaryrefslogtreecommitdiff
path: root/deploy.yml
diff options
context:
space:
mode:
Diffstat (limited to 'deploy.yml')
-rw-r--r--deploy.yml34
1 files changed, 34 insertions, 0 deletions
diff --git a/deploy.yml b/deploy.yml
new file mode 100644
index 0000000..2ecdad5
--- /dev/null
+++ b/deploy.yml
@@ -0,0 +1,34 @@
+- 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"
+ register: new_version
+ - name: Update
+ ansible.builtin.pip:
+ name:
+ - "file:///home/{{ ansible_facts.user_id }}/jwebmail-{{ latest_version }}-py3-none-any.whl"
+ virtualenv: "/usr/local/jwebmail"
+ become: true
+ - name: Extract
+ ansible.builtin.copy:
+ src: "script/extract-release"
+ dest: "/usr/local/bin/jwebmail-extract"
+ mode: "0755"
+ become: true
+ - name: Restart
+ ansible.builtin.systemd_service:
+ name: jwebmail
+ state: restarted
+ become: true
+ when: new_version is changed