Skip to content

Commit 00cb379

Browse files
committed
fix(storage): add docker systemd drop-in to prevent race with iscsi mounts on boot
1 parent d8ae518 commit 00cb379

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

ansible/roles/storage/handlers/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
ansible.builtin.systemd:
66
name: o2cb
77
state: reloaded
8+
9+
- name: reload systemd
10+
ansible.builtin.systemd:
11+
daemon_reload: yes

ansible/roles/storage/tasks/iscsi-mount.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,25 @@
151151
run_once: true
152152
delegate_to: "{{ groups['managers'][0] }}"
153153

154+
# Ensure Docker waits for iSCSI mounts before starting
155+
# Without this, Docker can race the mounts on boot and containers using
156+
# iSCSI-backed volumes will fail to start.
157+
- name: Create Docker systemd drop-in directory
158+
ansible.builtin.file:
159+
path: /etc/systemd/system/docker.service.d
160+
state: directory
161+
mode: "0755"
162+
163+
- name: Configure Docker to wait for iSCSI mounts
164+
ansible.builtin.copy:
165+
dest: /etc/systemd/system/docker.service.d/iscsi-wait.conf
166+
content: |
167+
[Unit]
168+
After=remote-fs.target open-iscsi.service
169+
Requires=open-iscsi.service
170+
mode: "0644"
171+
notify: reload systemd
172+
154173
# Display mount summary
155174
- name: Display mount summary
156175
ansible.builtin.debug:

0 commit comments

Comments
 (0)