|
8 | 8 | # Docker is needed because cloudmon's graphite/statsd/postgres |
9 | 9 | # provisioning playbooks deploy containerized components via |
10 | 10 | # ansible-runner. |
| 11 | +# |
| 12 | +# NOTE: the pod has no systemd as PID 1, so the docker/containerd |
| 13 | +# daemons are started directly (background processes), not via the |
| 14 | +# service or systemd modules. |
11 | 15 | - hosts: all |
12 | 16 | become: true |
13 | | - gather_facts: true |
| 17 | + gather_facts: false |
14 | 18 | vars: |
15 | 19 | docker_ce_packages: |
16 | 20 | - docker-ce |
|
41 | 45 | state: directory |
42 | 46 | mode: '0755' |
43 | 47 |
|
| 48 | + # Pod environment: known zuul-debian pod (Debian bookworm, amd64). |
| 49 | + # No ansible_facts available — hardcode values. |
44 | 50 | - name: Download Docker official GPG key |
45 | 51 | ansible.builtin.get_url: |
46 | | - url: "https://download.docker.com/linux/{{ ansible_facts['os_release']['ID'] }}/gpg" |
| 52 | + url: "https://download.docker.com/linux/debian/gpg" |
47 | 53 | dest: /etc/apt/keyrings/docker.asc |
48 | 54 | mode: '0644' |
49 | 55 |
|
|
52 | 58 | dest: /etc/apt/sources.list.d/docker-ce.list |
53 | 59 | mode: '0644' |
54 | 60 | content: >- |
55 | | - deb [arch={{ ansible_facts['architecture'] }} |
| 61 | + deb [arch=amd64 |
56 | 62 | signed-by=/etc/apt/keyrings/docker.asc] |
57 | | - https://download.docker.com/linux/{{ ansible_facts['os_release']['ID'] }} |
58 | | - {{ ansible_facts['os_release']['VERSION_CODENAME'] }} stable |
| 63 | + https://download.docker.com/linux/debian |
| 64 | + bookworm stable |
59 | 65 |
|
60 | 66 | # Remove conflicting Docker packages that may be in the distro image |
61 | 67 | - name: Remove conflicting Docker packages |
|
88 | 94 | - /var/run/docker.pid |
89 | 95 | failed_when: false |
90 | 96 |
|
91 | | - # Start and enable containerd and docker |
92 | | - - name: Start and enable containerd |
93 | | - ansible.builtin.systemd: |
94 | | - name: containerd |
95 | | - state: started |
96 | | - enabled: true |
| 97 | + # Start daemons directly — the pod has no init system to do it. |
| 98 | + - name: Start containerd daemon |
| 99 | + ansible.builtin.shell: |
| 100 | + cmd: nohup /usr/bin/containerd > /var/log/containerd.log 2>&1 & |
| 101 | + changed_when: true |
97 | 102 |
|
98 | | - - name: Start and enable Docker |
99 | | - ansible.builtin.systemd: |
100 | | - name: "{{ item }}" |
101 | | - state: started |
102 | | - enabled: true |
103 | | - loop: |
104 | | - - docker.socket |
105 | | - - docker.service |
| 103 | + - name: Wait for containerd socket (up to 30s) |
| 104 | + ansible.builtin.wait_for: |
| 105 | + path: /run/containerd/containerd.sock |
| 106 | + timeout: 30 |
| 107 | + |
| 108 | + - name: Start dockerd daemon |
| 109 | + ansible.builtin.shell: |
| 110 | + cmd: nohup /usr/bin/dockerd > /var/log/dockerd.log 2>&1 & |
| 111 | + changed_when: true |
| 112 | + |
| 113 | + - name: Wait for Docker socket to appear (up to 60s) |
| 114 | + ansible.builtin.wait_for: |
| 115 | + path: /var/run/docker.sock |
| 116 | + timeout: 60 |
106 | 117 |
|
107 | 118 | - name: Verify Docker daemon is running |
108 | 119 | ansible.builtin.command: |
|
0 commit comments