Configure TCP Keep-Alive parameters
diff --git a/roles/ci_agent/files/50-ci-agent.sysctl.conf b/roles/ci_agent/files/50-ci-agent.sysctl.conf
new file mode 100644
index 0000000..fc050d6
--- /dev/null
+++ b/roles/ci_agent/files/50-ci-agent.sysctl.conf
@@ -0,0 +1,8 @@
+# Start TCP Keep-Alive after two minutes
+net.ipv4.tcp_keepalive_time = 120
+
+# Probe for TCP liveness every 30s after Keep-Alive starts
+net.ipv4.tcp_keepalive_intvl = 30
+
+# Allow for up to 8 un-acked TCP Keep-Alive probes
+net.ipv4.tcp_keepalive_probes = 8
diff --git a/roles/ci_agent/tasks/main.yml b/roles/ci_agent/tasks/main.yml
index 9a59ac1..48064f2 100644
--- a/roles/ci_agent/tasks/main.yml
+++ b/roles/ci_agent/tasks/main.yml
@@ -1,3 +1,12 @@
+- name: Configure TCP Keep-Alive
+  copy:
+    src: 50-ci-agent.sysctl.conf
+    dest: /etc/sysctl.d/50-ci-agent.conf
+    mode: 0644
+
+- name: Load TCP Keep-Alive configuration
+  script: /sbin/sysctl --load /etc/sysctl.d/50-ci-agent.conf
+
 - name: Install Docker gpg key for Apt
   apt_key:
     url: https://download.docker.com/linux/debian/gpg