From 333d1078f8efdf01fec16e13cd97b0b9d698b48e Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 16 Nov 2023 18:42:39 +0100 Subject: [PATCH] renamed to heal-docker --- .../handlers/main.yml | 12 ---------- .../tasks/main.yml | 22 ------------------- roles/docker/meta/main.yml | 2 +- .../README.md | 2 +- .../files/heal-docker.py} | 0 roles/heal-docker/handlers/main.yml | 12 ++++++++++ roles/heal-docker/tasks/main.yml | 22 +++++++++++++++++++ .../templates/heal-docker.service.j2} | 2 +- .../templates/heal-docker.timer.j2} | 2 +- .../vars/main.yml | 2 +- 10 files changed, 39 insertions(+), 39 deletions(-) delete mode 100644 roles/docker-compose-restart-unhealthy/handlers/main.yml delete mode 100644 roles/docker-compose-restart-unhealthy/tasks/main.yml rename roles/{docker-compose-restart-unhealthy => heal-docker}/README.md (65%) rename roles/{docker-compose-restart-unhealthy/files/docker-compose-restart-unhealthy.py => heal-docker/files/heal-docker.py} (100%) create mode 100644 roles/heal-docker/handlers/main.yml create mode 100644 roles/heal-docker/tasks/main.yml rename roles/{docker-compose-restart-unhealthy/templates/docker-compose-restart-unhealthy.service.j2 => heal-docker/templates/heal-docker.service.j2} (55%) rename roles/{docker-compose-restart-unhealthy/templates/docker-compose-restart-unhealthy.timer.j2 => heal-docker/templates/heal-docker.timer.j2} (74%) rename roles/{docker-compose-restart-unhealthy => heal-docker}/vars/main.yml (64%) diff --git a/roles/docker-compose-restart-unhealthy/handlers/main.yml b/roles/docker-compose-restart-unhealthy/handlers/main.yml deleted file mode 100644 index d16bba4c..00000000 --- a/roles/docker-compose-restart-unhealthy/handlers/main.yml +++ /dev/null @@ -1,12 +0,0 @@ -- name: "reload docker-compose-restart-unhealthy.service" - systemd: - name: docker-compose-restart-unhealthy.service - state: reloaded - enabled: yes - daemon_reload: yes -- name: "restart docker-compose-restart-unhealthy.timer" - systemd: - name: docker-compose-restart-unhealthy.timer - state: restarted - enabled: yes - daemon_reload: yes diff --git a/roles/docker-compose-restart-unhealthy/tasks/main.yml b/roles/docker-compose-restart-unhealthy/tasks/main.yml deleted file mode 100644 index 07059f43..00000000 --- a/roles/docker-compose-restart-unhealthy/tasks/main.yml +++ /dev/null @@ -1,22 +0,0 @@ -- name: "create {{docker_compose_restart_unhealthy}}" - file: - path: "{{docker_compose_restart_unhealthy}}" - state: directory - mode: 0755 - -- name: create docker-compose-restart-unhealthy.py - copy: - src: docker-compose-restart-unhealthy.py - dest: "{{docker_compose_restart_unhealthy}}docker-compose-restart-unhealthy.py" - -- name: create docker-compose-restart-unhealthy.service - template: - src: docker-compose-restart-unhealthy.service.j2 - dest: /etc/systemd/system/docker-compose-restart-unhealthy.service - notify: reload docker-compose-restart-unhealthy.service - -- name: create docker-compose-restart-unhealthy.timer - template: - src: docker-compose-restart-unhealthy.timer.j2 - dest: "/etc/systemd/system/docker-compose-restart-unhealthy.timer" - notify: restart docker-compose-restart-unhealthy.timer \ No newline at end of file diff --git a/roles/docker/meta/main.yml b/roles/docker/meta/main.yml index 43ae45d0..85ce8157 100644 --- a/roles/docker/meta/main.yml +++ b/roles/docker/meta/main.yml @@ -2,4 +2,4 @@ dependencies: - backup-docker-to-local - user-administrator - health-docker - - docker-compose-restart-unhealthy + - heal-docker diff --git a/roles/docker-compose-restart-unhealthy/README.md b/roles/heal-docker/README.md similarity index 65% rename from roles/docker-compose-restart-unhealthy/README.md rename to roles/heal-docker/README.md index 246761fa..4b88f314 100644 --- a/roles/docker-compose-restart-unhealthy/README.md +++ b/roles/heal-docker/README.md @@ -1,2 +1,2 @@ -# docker-compose-restart-unhealthy +# heal-docker docker-compose restart for containers which are unhealty or excited \ No newline at end of file diff --git a/roles/docker-compose-restart-unhealthy/files/docker-compose-restart-unhealthy.py b/roles/heal-docker/files/heal-docker.py similarity index 100% rename from roles/docker-compose-restart-unhealthy/files/docker-compose-restart-unhealthy.py rename to roles/heal-docker/files/heal-docker.py diff --git a/roles/heal-docker/handlers/main.yml b/roles/heal-docker/handlers/main.yml new file mode 100644 index 00000000..2da3a60f --- /dev/null +++ b/roles/heal-docker/handlers/main.yml @@ -0,0 +1,12 @@ +- name: "reload heal-docker.service" + systemd: + name: heal-docker.service + state: reloaded + enabled: yes + daemon_reload: yes +- name: "restart heal-docker.timer" + systemd: + name: heal-docker.timer + state: restarted + enabled: yes + daemon_reload: yes diff --git a/roles/heal-docker/tasks/main.yml b/roles/heal-docker/tasks/main.yml new file mode 100644 index 00000000..5dd14c23 --- /dev/null +++ b/roles/heal-docker/tasks/main.yml @@ -0,0 +1,22 @@ +- name: "create {{docker_compose_restart_unhealthy}}" + file: + path: "{{docker_compose_restart_unhealthy}}" + state: directory + mode: 0755 + +- name: create heal-docker.py + copy: + src: heal-docker.py + dest: "{{docker_compose_restart_unhealthy}}heal-docker.py" + +- name: create heal-docker.service + template: + src: heal-docker.service.j2 + dest: /etc/systemd/system/heal-docker.service + notify: reload heal-docker.service + +- name: create heal-docker.timer + template: + src: heal-docker.timer.j2 + dest: "/etc/systemd/system/heal-docker.timer" + notify: restart heal-docker.timer \ No newline at end of file diff --git a/roles/docker-compose-restart-unhealthy/templates/docker-compose-restart-unhealthy.service.j2 b/roles/heal-docker/templates/heal-docker.service.j2 similarity index 55% rename from roles/docker-compose-restart-unhealthy/templates/docker-compose-restart-unhealthy.service.j2 rename to roles/heal-docker/templates/heal-docker.service.j2 index 3cc34358..c796a74b 100644 --- a/roles/docker-compose-restart-unhealthy/templates/docker-compose-restart-unhealthy.service.j2 +++ b/roles/heal-docker/templates/heal-docker.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/bin/python {{docker_compose_restart_unhealthy}}docker-compose-restart-unhealthy.py +ExecStart=/bin/python {{docker_compose_restart_unhealthy}}heal-docker.py diff --git a/roles/docker-compose-restart-unhealthy/templates/docker-compose-restart-unhealthy.timer.j2 b/roles/heal-docker/templates/heal-docker.timer.j2 similarity index 74% rename from roles/docker-compose-restart-unhealthy/templates/docker-compose-restart-unhealthy.timer.j2 rename to roles/heal-docker/templates/heal-docker.timer.j2 index 83c6da5d..5003237c 100644 --- a/roles/docker-compose-restart-unhealthy/templates/docker-compose-restart-unhealthy.timer.j2 +++ b/roles/heal-docker/templates/heal-docker.timer.j2 @@ -1,5 +1,5 @@ [Unit] -Description=starts docker-compose-restart-unhealthy.service +Description=starts heal-docker.service [Timer] OnCalendar={{on_calendar_docker_compose_restart_unhealthy}} diff --git a/roles/docker-compose-restart-unhealthy/vars/main.yml b/roles/heal-docker/vars/main.yml similarity index 64% rename from roles/docker-compose-restart-unhealthy/vars/main.yml rename to roles/heal-docker/vars/main.yml index bd60144f..e2244974 100644 --- a/roles/docker-compose-restart-unhealthy/vars/main.yml +++ b/roles/heal-docker/vars/main.yml @@ -1 +1 @@ -docker_compose_restart_unhealthy: "{{path_administrator_scripts}}docker-compose-restart-unhealthy/" \ No newline at end of file +docker_compose_restart_unhealthy: "{{path_administrator_scripts}}heal-docker/" \ No newline at end of file