summaryrefslogtreecommitdiff
path: root/deploy.yml
blob: 2ecdad570ba8acbfe7442df97da418ae2413d126 (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
- 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