From 9313e0a8ff7996c34be78b31dfed0271a454c689 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Fri, 10 Sep 2021 10:46:39 +0100
Subject: [PATCH] We no longer need to restart containers to pick up changes in
 /etc/hosts

---
 roles/float-base-docker/tasks/main.yml | 25 -------------------------
 1 file changed, 25 deletions(-)

diff --git a/roles/float-base-docker/tasks/main.yml b/roles/float-base-docker/tasks/main.yml
index 6d08dcfc..9be351d2 100644
--- a/roles/float-base-docker/tasks/main.yml
+++ b/roles/float-base-docker/tasks/main.yml
@@ -69,28 +69,3 @@
     - debug:
         msg: "Failed to clean up containers"
 
-# Restart containers that have an old /etc/hosts file, to update their
-# service discovery.
-
-- name: Restart containers with an old /etc/hosts
-  block:
-
-    - stat:
-        path: "/etc/hosts"
-      register: etc_hosts_stat
-
-    - name: Find containers that need a restart
-      shell: "{{ container_runtime }} ps --format={% raw %}'{{.Names}} {{.Created}}'{% endraw %} | sed -e 's,[-+][0-9]* [A-Z]*$,,' | while read name d t ; do s=$(date --date=\"$d $t\" +%s); echo \"$name $s\"; done | awk '$2 < {{ etc_hosts_stat.stat.mtime | int }} {print $1}'"
-      register: containers_to_restart
-      changed_when: false
-      check_mode: no
-
-    - name: Restart containers with an old /etc/hosts
-      systemd:
-        name: "docker-{{ item }}.service"
-        state: restarted
-      loop: "{{ containers_to_restart.stdout_lines }}"
-
-  rescue:
-    - debug:
-        msg: "Failed to restart containers with old /etc/hosts"
-- 
GitLab