|
8 | 8 | # - node key files (*.key) |
9 | 9 | # - config.yaml, validators.yaml, nodes.yaml |
10 | 10 | # - genesis.ssz, genesis.json |
11 | | -# - hash-sig-keys/ directory (if exists, for qlean nodes) |
| 11 | +# - hash-sig-keys/ directory (if exists): only the sk/pk files for this node's validators |
12 | 12 |
|
13 | 13 | - name: Parse and validate node names |
14 | 14 | hosts: localhost |
|
122 | 122 |
|
123 | 123 | - name: Sync validator-config.yaml to remote host |
124 | 124 | copy: |
125 | | - src: "{{ local_genesis_dir }}/validator-config.yaml" |
| 125 | + # Use the expanded subnet config when --subnets was specified; fall back |
| 126 | + # to the standard validator-config.yaml otherwise. The destination is |
| 127 | + # always validator-config.yaml so client roles don't need to change. |
| 128 | + src: "{{ local_genesis_dir }}/{{ validator_config_basename | default('validator-config.yaml') }}" |
126 | 129 | dest: "{{ genesis_dir }}/validator-config.yaml" |
127 | 130 | mode: '0644' |
128 | 131 | force: yes |
|
149 | 152 | loop: |
150 | 153 | - config.yaml |
151 | 154 | - validators.yaml |
| 155 | + - annotated_validators.yaml |
152 | 156 | - nodes.yaml |
153 | 157 | - genesis.ssz |
154 | 158 | - genesis.json |
|
165 | 169 | - deploy |
166 | 170 | - sync |
167 | 171 |
|
| 172 | + - name: Resolve hash-sig key files for this node |
| 173 | + vars: |
| 174 | + _av: "{{ lookup('file', local_genesis_dir + '/annotated_validators.yaml') | from_yaml }}" |
| 175 | + _assignments: "{{ _av[node_name] | default([]) }}" |
| 176 | + _base: "{{ _assignments | map(attribute='privkey_file') | map('regex_replace', '_sk\\.ssz$', '') | list }}" |
| 177 | + set_fact: |
| 178 | + node_hash_sig_files: "{{ (_base | product(['_sk.ssz', '_pk.ssz', '_sk.json', '_pk.json']) | map('join') | list) + ['validator-keys-manifest.yaml'] }}" |
| 179 | + when: hash_sig_keys_local.stat.exists |
| 180 | + tags: |
| 181 | + - deploy |
| 182 | + - sync |
| 183 | + |
168 | 184 | - name: Create hash-sig-keys directory on remote |
169 | 185 | file: |
170 | 186 | path: "{{ genesis_dir }}/hash-sig-keys" |
171 | 187 | state: directory |
172 | 188 | mode: '0755' |
173 | | - when: hash_sig_keys_local.stat.exists |
| 189 | + when: hash_sig_keys_local.stat.exists and (node_hash_sig_files | default([]) | length > 0) |
174 | 190 | tags: |
175 | 191 | - deploy |
176 | 192 | - sync |
177 | 193 |
|
178 | | - - name: Sync hash-sig-keys directory (for qlean nodes) |
| 194 | + - name: Copy hash-sig key files for this node only |
179 | 195 | copy: |
180 | | - src: "{{ local_genesis_dir }}/hash-sig-keys/" |
181 | | - dest: "{{ genesis_dir }}/hash-sig-keys/" |
182 | | - mode: '0644' |
| 196 | + src: "{{ local_genesis_dir }}/hash-sig-keys/{{ item }}" |
| 197 | + dest: "{{ genesis_dir }}/hash-sig-keys/{{ item }}" |
| 198 | + mode: '0600' |
183 | 199 | force: yes |
184 | | - when: hash_sig_keys_local.stat.exists |
| 200 | + loop: "{{ node_hash_sig_files | default([]) }}" |
| 201 | + when: hash_sig_keys_local.stat.exists and (node_hash_sig_files | default([]) | length > 0) |
185 | 202 | tags: |
186 | 203 | - deploy |
187 | 204 | - sync |
|
199 | 216 | - lighthouse |
200 | 217 | - grandine |
201 | 218 | - ethlambda |
| 219 | + - gean |
| 220 | + - nlean |
| 221 | + - peam |
202 | 222 | - deploy |
203 | 223 |
|
204 | 224 | - name: Include common role |
|
224 | 244 | tags: |
225 | 245 | - deploy |
226 | 246 |
|
| 247 | +# When --replace-with is used, sync updated config yamls to all remote hosts |
| 248 | +- name: Sync updated config files to all hosts after replacement |
| 249 | + hosts: all:!local |
| 250 | + gather_facts: no |
| 251 | + vars: |
| 252 | + genesis_dir: "{{ remote_genesis_dir | default('/opt/lean-quickstart/genesis') }}" |
| 253 | + local_genesis_dir: "{{ hostvars['localhost']['local_genesis_dir_path'] }}" |
| 254 | + tasks: |
| 255 | + - name: Sync config yamls to all hosts |
| 256 | + copy: |
| 257 | + src: "{{ local_genesis_dir }}/{{ item }}" |
| 258 | + dest: "{{ genesis_dir }}/{{ item }}" |
| 259 | + mode: '0644' |
| 260 | + force: yes |
| 261 | + loop: |
| 262 | + - validators.yaml |
| 263 | + - annotated_validators.yaml |
| 264 | + - nodes.yaml |
| 265 | + - validator-config.yaml |
| 266 | + when: sync_all_hosts | default(false) | bool |
| 267 | + tags: |
| 268 | + - deploy |
| 269 | + - sync |
| 270 | + |
| 271 | + - name: Sync validator-keys-manifest to all hosts |
| 272 | + copy: |
| 273 | + src: "{{ local_genesis_dir }}/hash-sig-keys/validator-keys-manifest.yaml" |
| 274 | + dest: "{{ genesis_dir }}/hash-sig-keys/validator-keys-manifest.yaml" |
| 275 | + mode: '0644' |
| 276 | + force: yes |
| 277 | + when: sync_all_hosts | default(false) | bool |
| 278 | + tags: |
| 279 | + - deploy |
| 280 | + - sync |
0 commit comments