ansible-docker-mailcow/roles/mailcow-ansiblerole/tasks/update.yml
Jesko Anschütz d563801458 initial
2025-03-20 10:39:09 +01:00

36 lines
835 B
YAML

---
- name: Copy updater script
become: yes
template:
src: updater.sh.j2
dest: /opt/mailcowupdater.sh
mode: '0777'
- name: Create update logs directory
become: yes
file:
dest: /var/log/mailcow-update/
state: directory
- name: Update mailcow
become: yes
shell: /opt/mailcowupdater.sh
args:
executable: /bin/bash
register: mailcow_update
changed_when: 'not "No updates are available" in mailcow_update.stdout'
tags:
- skip_ansible_lint
- name: Show mailcow update log
debug:
var: mailcow_update.stdout_lines
- name: Write update log to file
become: yes
copy:
content: "{{ mailcow_update.stdout }}"
dest: "/var/log/mailcow-update/update-{{ ansible_date_time.iso8601_basic_short }}.log"
no_log: True
when: 'not "No updates are available" in mailcow_update.stdout'