|
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | 15 | --- |
16 | | -- name: Wait until all network interfaces are online for A3/A4 variants |
| 16 | +- name: Install network wait service for A3/A4 variants |
17 | 17 | hosts: all |
18 | 18 | become: true |
19 | 19 | tasks: |
20 | | - - name: Create SystemD service for A3 High networking |
21 | | - when: ansible_os_family == "Debian" |
22 | | - ansible.builtin.copy: |
23 | | - dest: /etc/systemd/system/delay-a3-high.service |
24 | | - owner: root |
25 | | - group: root |
26 | | - mode: "0644" |
27 | | - content: | |
28 | | - [Unit] |
29 | | - Description=Delay A3 High boot until all network interfaces are routable |
30 | | - After=network-online.target |
31 | | - Wants=network-online.target |
32 | | - Before=google-startup-scripts.service |
33 | | -
|
34 | | - [Service] |
35 | | - # Condition to only run on A3 High machines |
36 | | - ExecCondition=/bin/bash -c '/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/machine-type | grep -q "/a3-highgpu-8g$"' |
37 | | - ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i enp0s12 -i enp6s0 -i enp12s0 -i enp134s0 -i enp140s0 -o routable --timeout=180 |
38 | | - ExecStartPost=/bin/sleep 30 |
39 | | -
|
40 | | - [Install] |
41 | | - WantedBy=multi-user.target |
42 | | - notify: |
43 | | - - Reload SystemD |
44 | | - |
45 | | - - name: Create SystemD service for A3 Mega networking |
46 | | - when: ansible_os_family == "Debian" |
47 | | - ansible.builtin.copy: |
48 | | - dest: /etc/systemd/system/delay-a3-mega.service |
49 | | - owner: root |
50 | | - group: root |
51 | | - mode: "0644" |
52 | | - content: | |
53 | | - [Unit] |
54 | | - Description=Delay A3 Mega boot until all network interfaces are routable |
55 | | - After=network-online.target |
56 | | - Wants=network-online.target |
57 | | - Before=google-startup-scripts.service |
58 | | -
|
59 | | - [Service] |
60 | | - # Condition to only run on A3 Mega machines |
61 | | - ExecCondition=/bin/bash -c '/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/machine-type | grep -q "/a3-megagpu-8g$"' |
62 | | - ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i enp0s12 -i enp6s0f0 -i enp7s0f0 -i enp13s0f0 -i enp14s0f0 -i enp134s0f0 -i enp135s0f0 -i enp141s0f0 -i enp142s0f0 -o routable --timeout=180 |
63 | | - ExecStartPost=/bin/sleep 30 |
64 | | -
|
65 | | - [Install] |
66 | | - WantedBy=multi-user.target |
67 | | - notify: |
68 | | - - Reload SystemD |
69 | | - |
70 | | - - name: Create SystemD service for A3 Ultra networking |
71 | | - when: ansible_os_family == "Debian" |
72 | | - ansible.builtin.copy: |
73 | | - dest: /etc/systemd/system/delay-a3-ultra.service |
74 | | - owner: root |
75 | | - group: root |
76 | | - mode: "0644" |
77 | | - content: | |
78 | | - [Unit] |
79 | | - Description=Delay A3 Ultra boot until all network interfaces are routable |
80 | | - After=network-online.target |
81 | | - Wants=network-online.target |
82 | | - Before=google-startup-scripts.service |
83 | | -
|
84 | | - [Service] |
85 | | - # Condition to only run on A3 Ultra machines |
86 | | - ExecCondition=/bin/bash -c '/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/machine-type | grep -q "/a3-ultragpu-8g$"' |
87 | | - ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i enp0s19 -i enp192s20 -i gpu0rdma0 -i gpu1rdma0 - gpu2rdma0 -i gpu3rdma0 -i gpu4rdma0 -i gpu5rdma0 -i gpu6rdma0 -i gpu7rdma0 -o routable --timeout=180 |
88 | | - ExecStartPost=/bin/sleep 30 |
89 | | -
|
90 | | - [Install] |
91 | | - WantedBy=multi-user.target |
92 | | - notify: |
93 | | - - Reload SystemD |
94 | 20 |
|
95 | | - - name: Create SystemD service for A4 High networking |
| 21 | + - name: Create universal SystemD service for GPU networking delay |
96 | 22 | when: ansible_os_family == "Debian" |
97 | 23 | ansible.builtin.copy: |
98 | | - dest: /etc/systemd/system/delay-a4-high.service |
| 24 | + dest: /etc/systemd/system/delay-gpu-network.service |
99 | 25 | owner: root |
100 | 26 | group: root |
101 | 27 | mode: "0644" |
102 | 28 | content: | |
103 | 29 | [Unit] |
104 | | - Description=Delay A4 High boot until all network interfaces are routable |
| 30 | + Description=Delay boot on multi-NIC VMs until networks are routable |
105 | 31 | After=network-online.target |
106 | 32 | Wants=network-online.target |
107 | 33 | Before=google-startup-scripts.service |
108 | 34 |
|
109 | 35 | [Service] |
110 | | - # Condition to only run on A4 High machines |
111 | | - ExecCondition=/bin/bash -c '/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/machine-type | grep -q "/a4-highgpu-8g$"' |
112 | | - ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i enp0s19 -i enp192s20 -i gpu0rdma0 -i gpu1rdma0 - gpu2rdma0 -i gpu3rdma0 -i gpu4rdma0 -i gpu5rdma0 -i gpu6rdma0 -i gpu7rdma0 -o routable --timeout=180 |
| 36 | + # This condition checks if the machine type is one of the supported A3/A4 variants. |
| 37 | + # The service will only run if the machine type matches. |
| 38 | + ExecCondition=/bin/bash -c "/usr/bin/curl -s -H 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/instance/machine-type | grep -qE '(/a3-highgpu-8g|/a3-megagpu-8g|/a3-ultragpu-8g|/a4-highgpu-8g|/a4x-highgpu-4g)$'" |
| 39 | + ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -o routable --timeout=180 |
113 | 40 | ExecStartPost=/bin/sleep 30 |
114 | | - # To debug interface names on an A4 instance, run: ip link show |
115 | 41 |
|
116 | 42 | [Install] |
117 | 43 | WantedBy=multi-user.target |
118 | 44 | notify: |
119 | 45 | - Reload SystemD |
120 | 46 |
|
121 | | - - name: Enable A3/A4 delay services |
| 47 | + - name: Enable universal GPU network delay service |
122 | 48 | when: ansible_os_family == "Debian" |
123 | 49 | ansible.builtin.systemd_service: |
124 | | - name: "{{ item }}" |
| 50 | + name: delay-gpu-network.service |
125 | 51 | enabled: true |
126 | | - loop: |
127 | | - - delay-a3-high.service |
128 | | - - delay-a3-mega.service |
129 | | - - delay-a3-ultra.service |
130 | | - - delay-a4-high.service |
131 | 52 |
|
132 | 53 | handlers: |
133 | 54 | - name: Reload SystemD |
|
0 commit comments