From 14e5cb053767151a6fecb163eccf964fecb5b8dc Mon Sep 17 00:00:00 2001 From: "pulsar89.5" Date: Tue, 18 Jun 2024 12:36:04 +0200 Subject: [PATCH] feat: Allow container auto update --- defaults/main.yml | 2 ++ tasks/configuration.yml | 15 +++++++++++++++ tasks/installation.yml | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 6e762ce..d8dfc5a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -7,6 +7,8 @@ podman_fix_pasta: true podman_ssh_host: "{{ inventory_hostname }}" podman_ssh_port: 22 +podman_auto_update: true + podman_containers: [] # Exemple: # - image: docker.io/wallabag/wallabag:latest diff --git a/tasks/configuration.yml b/tasks/configuration.yml index 68a1252..901b946 100644 --- a/tasks/configuration.yml +++ b/tasks/configuration.yml @@ -65,3 +65,18 @@ label: "{{ item.item.name }}" vars: container_user: "podman-{{ item.item.user | default(item.item.name) }}" + +- name: Activer le service de mise à jour automatique + ansible.builtin.systemd_service: + name: podman-auto-update.timer + daemon_reload: true + enabled: true + scope: user + when: podman_auto_update + become: true + become_user: "{{ container_user }}" + loop: "{{ deploy_container.results }}" + loop_control: + label: "{{ item.item.name }}" + vars: + container_user: "podman-{{ item.item.user | default(item.item.name) }}" diff --git a/tasks/installation.yml b/tasks/installation.yml index 726e71e..0313371 100644 --- a/tasks/installation.yml +++ b/tasks/installation.yml @@ -39,3 +39,9 @@ when: podman_configure_rsyslog become: true notify: Redémarrer rsyslog.service + +- name: Désactiver le service de mise à jour automatique pour root + ansible.builtin.systemd_service: + name: podman-auto-update.timer + enabled: false + become: true