summaryrefslogtreecommitdiff
path: root/depoly.yml
blob: e55d2bb5e1cfe3b22b49f388e1ec2ace5bc57de0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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