Added auto restart role for docker

This commit is contained in:
2024-12-01 15:02:09 +01:00
parent e243d91145
commit 85816d702a
9 changed files with 138 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
- block:
- name: "create {{restart_docker_volumes_folder}}"
file:
path: "{{restart_docker_volumes_folder}}"
state: directory
mode: 0755
- name: create {{restart_docker_script}}
copy:
src: restart-docker.py
dest: "{{restart_docker_script}}"
when: run_once_restart_docker is not defined
- name: configure restart-docker.cymais.service
template:
src: restart-docker.service.j2
dest: /etc/systemd/system/restart-docker.cymais.service
notify: "reload restart-docker.cymais.service"
when: run_once_restart_docker is not defined
- name: set service_name to the name of the current role
set_fact:
service_name: "{{ role_name }}"
when: run_once_restart_docker is not defined
when: run_once_restart_docker is not defined
- name: "include role for systemd-timer for {{service_name}}"
include_role:
name: systemd-timer
vars:
on_calendar: "{{on_calendar_restart_docker}}"
when: run_once_restart_docker is not defined
- name: run the restart_docker_volumes tasks once
set_fact:
run_once_restart_docker: true
when: run_once_restart_docker is not defined