|
18 | 18 | hosts: instance
|
19 | 19 | vars:
|
20 | 20 | ansible_user_dir: "{{ lookup('env', 'HOME') }}"
|
21 |
| - cifmw_basedir: "/opt/basedir" |
| 21 | + cifmw_basedir: "{{ ansible_user_dir }}/ci-framework-data" |
22 | 22 | tasks:
|
23 | 23 | - name: Crate SSH keypair
|
24 | 24 | register: _test_key
|
|
27 | 27 | path: "{{ (ansible_user_dir, '.ssh/id_test') | path_join }}"
|
28 | 28 | type: "ecdsa"
|
29 | 29 |
|
| 30 | + - name: Enable forwarding in the libvirt zone |
| 31 | + become: true |
| 32 | + ansible.builtin.command: |
| 33 | + cmd: >- |
| 34 | + firewall-cmd --permanent --zone libvirt --add-forward |
| 35 | +
|
| 36 | + - name: Restart firewalld.service |
| 37 | + become: true |
| 38 | + ansible.builtin.systemd_service: |
| 39 | + name: firewalld |
| 40 | + state: restarted |
| 41 | + |
30 | 42 | - name: Discover latest image
|
31 | 43 | when:
|
32 | 44 | - cifmw_discovered_image_url is not defined
|
|
53 | 65 | ansible.builtin.include_role:
|
54 | 66 | name: nat64_appliance
|
55 | 67 |
|
| 68 | + - name: Fix permissions on logs dir - because we ran dib as root |
| 69 | + become: true |
| 70 | + ansible.builtin.file: |
| 71 | + path: "{{ cifmw_basedir }}/logs" |
| 72 | + state: directory |
| 73 | + recurse: true |
| 74 | + owner: "{{ ansible_user_id }}" |
| 75 | + group: "{{ ansible_user_gid }}" |
| 76 | + |
56 | 77 | - name: Fix permissions on nat64_appliance dir - because we ran dib as root
|
57 | 78 | become: true
|
58 | 79 | ansible.builtin.file:
|
|
82 | 103 | <network>
|
83 | 104 | <name>br-mol</name>
|
84 | 105 | <forward mode='open'/>
|
85 |
| - <bridge name='br-mol' stp='on' delay='0'/> |
| 106 | + <bridge name='br-mol' zone='libvirt' stp='on' delay='0'/> |
86 | 107 | <ip family='ipv6' address='2620:cf:cf:aaaa::1' prefix='64'/>
|
87 | 108 | <dns>
|
88 | 109 | <forwarder addr='2620:cf:cf:fc00::2'/>
|
|
108 | 129 | name: br-mol
|
109 | 130 | uri: 'qemu:///system'
|
110 | 131 |
|
| 132 | + # TODO(hjensas): With the zone set in libvirt XML this bridge "should" |
| 133 | + # already be in this zone. But logs indicate that it is not. |
| 134 | + # See: https://libvirt.org/formatnetwork.html |
| 135 | + - name: Make sure br-mol bridge is in the libvirt firewalld zone |
| 136 | + become: true |
| 137 | + ansible.posix.firewalld: |
| 138 | + zone: libvirt |
| 139 | + interface: br-mol |
| 140 | + state: enabled |
| 141 | + permanent: true |
| 142 | + |
| 143 | + - name: Restart firewalld.service |
| 144 | + become: true |
| 145 | + ansible.builtin.systemd_service: |
| 146 | + name: firewalld |
| 147 | + state: restarted |
| 148 | + |
111 | 149 | - name: Generate test node UUID
|
112 | 150 | ansible.builtin.set_fact:
|
113 | 151 | test_node_uuid: "{{ 99999999 | random | to_uuid | lower }}"
|
|
261 | 299 | ansible.builtin.add_host:
|
262 | 300 | name: test-node
|
263 | 301 | groups:
|
264 |
| - - test_nodes |
| 302 | + - testnodes |
265 | 303 | ansible_host: '2620:cf:cf:aaaa::101'
|
266 | 304 | ansible_ssh_user: 'cloud-user'
|
267 | 305 | ansible_ssh_private_key_file: "{{ _test_key.filename }}"
|
268 | 306 | ansible_ssh_extra_args: '-o StrictHostKeyChecking=no'
|
269 | 307 |
|
| 308 | + - name: Add nat64 appliance to the invetory |
| 309 | + ansible.builtin.add_host: |
| 310 | + name: nat64-appliance |
| 311 | + groups: |
| 312 | + - nat64appliances |
| 313 | + ansible_host: '172.31.255.2' |
| 314 | + ansible_ssh_user: 'cloud-user' |
| 315 | + ansible_ssh_private_key_file: "{{ _test_key.filename }}" |
| 316 | + ansible_ssh_extra_args: '-o StrictHostKeyChecking=no' |
| 317 | + |
270 | 318 | # Even tough the node respond on port 22, let some time to ensure
|
271 | 319 | # ssh access for users is available.
|
272 | 320 | - name: Wait a little to let the test instance boot.
|
273 | 321 | ansible.builtin.pause:
|
274 | 322 | seconds: 20
|
275 | 323 |
|
| 324 | + - name: Run some commands to test the nat64-appliance DNS64 functions |
| 325 | + register: _nat64_appliance_dns64_debug |
| 326 | + ansible.builtin.shell: | |
| 327 | + echo "--- ping the DNS service listening address ---" |
| 328 | + ping -c 4 2620:cf:cf:fc00::2 || true |
| 329 | + echo |
| 330 | + echo "--- Try to resolve a name using 2620:cf:cf:fc00::2 ---" |
| 331 | + dig AAAA @2620:cf:cf:fc00::2 example.com |
| 332 | + echo |
| 333 | + echo "--- Try to resolve a name forwarding on test-network 2620:cf:cf:aaaa::1 ---" |
| 334 | + dig AAAA @2620:cf:cf:aaaa::1 example.com |
| 335 | + echo |
| 336 | + echo "--- Try to ping exmaple.com ---" |
| 337 | + ping -c 4 example.com || true |
| 338 | +
|
| 339 | + - name: Grab some info from the test node |
| 340 | + become: true |
| 341 | + delegate_to: test-node |
| 342 | + register: _test_node_debug_info |
| 343 | + ansible.builtin.shell: | |
| 344 | + echo "--- ip addr show ---" |
| 345 | + ip addr show |
| 346 | + echo |
| 347 | + echo "--- ip -6 route show ---" |
| 348 | + ip -6 route show |
| 349 | + echo |
| 350 | + echo "--- /etc/resolv.conf ---" |
| 351 | + cat /etc/resolv.conf |
| 352 | + echo |
| 353 | + echo "--- NetworkManager system-connections ---" |
| 354 | + for file in $(find /etc/NetworkManager/system-connections/ -type f); do |
| 355 | + echo "--- $file ---" |
| 356 | + cat $file |
| 357 | + echo |
| 358 | + done |
| 359 | +
|
| 360 | + - name: Grab some info from the nat64 appliance |
| 361 | + become: true |
| 362 | + delegate_to: nat64-appliance |
| 363 | + register: _nat64_appliance_debug_info |
| 364 | + ansible.builtin.shell: | |
| 365 | + echo "--- ip addr show ---" |
| 366 | + ip addr show |
| 367 | + echo |
| 368 | + echo "--- ip -4 route show ---" |
| 369 | + ip -4 route show |
| 370 | + echo |
| 371 | + echo "--- ip -6 route show ---" |
| 372 | + ip -6 route show |
| 373 | + echo |
| 374 | + echo "--- /etc/resolv.conf ---" |
| 375 | + cat /etc/resolv.conf |
| 376 | + echo |
| 377 | + echo "--- NetworkManager system-connections ---" |
| 378 | + for file in $(find /etc/NetworkManager/system-connections/ -type f); do |
| 379 | + echo "--- $file ---" |
| 380 | + cat $file |
| 381 | + echo |
| 382 | + done |
| 383 | + echo |
| 384 | + echo "--- systemctl status unbound.service ---" |
| 385 | + systemctl status unbound.service |
| 386 | + echo |
| 387 | + echo "--- systemctl status nat64-v4-dnsmasq.service ---" |
| 388 | + systemctl status nat64-v4-dnsmasq.service |
| 389 | + echo |
| 390 | + echo "--- systemctl status nat64-v6-dnsmasq.service ---" |
| 391 | + systemctl status nat64-v6-dnsmasq.service |
| 392 | +
|
| 393 | + - name: Grab the journal from the nat64 appliance |
| 394 | + become: true |
| 395 | + delegate_to: nat64-appliance |
| 396 | + register: _nat64_appliance_journal |
| 397 | + ansible.builtin.shell: | |
| 398 | + journalctl -b --no-pager |
| 399 | +
|
| 400 | + - name: Grab some info from hypervisor |
| 401 | + become: true |
| 402 | + delegate_to: instance |
| 403 | + register: _hypervisor_info |
| 404 | + ansible.builtin.shell: | |
| 405 | + echo "--- ip addr show ---" |
| 406 | + ip addr show |
| 407 | + echo |
| 408 | + echo "--- ip -4 route show ---" |
| 409 | + ip -4 route show |
| 410 | + echo |
| 411 | + echo "--- ip -6 route show ---" |
| 412 | + ip -6 route show |
| 413 | + echo |
| 414 | + echo "--- firewall - list-all-zones" |
| 415 | + firewall-cmd --list-all-zones |
| 416 | + echo |
| 417 | + echo "--- sysctl - list all" |
| 418 | + sysctl -a |
| 419 | +
|
| 420 | + - name: Write test-node info to file |
| 421 | + ansible.builtin.copy: |
| 422 | + dest: "{{ cifmw_basedir }}/logs/test_node_info.log" |
| 423 | + content: "{{ _test_node_debug_info.stdout }}" |
| 424 | + |
| 425 | + - name: Write nat64-appliance info to file |
| 426 | + ansible.builtin.copy: |
| 427 | + dest: "{{ cifmw_basedir }}/logs/nat64_appliance_node_info.log" |
| 428 | + content: "{{ _nat64_appliance_debug_info.stdout }}" |
| 429 | + |
| 430 | + - name: Write nat64-appliance journal to file |
| 431 | + ansible.builtin.copy: |
| 432 | + dest: "{{ cifmw_basedir }}/logs/nat64_appliance_journal.log" |
| 433 | + content: "{{ _nat64_appliance_journal.stdout }}" |
| 434 | + |
| 435 | + - name: Write nat64-appliance DNS64 debug to file |
| 436 | + ansible.builtin.copy: |
| 437 | + dest: "{{ cifmw_basedir }}/logs/nat64_appliance_dns64_debug.log" |
| 438 | + content: "{{ _nat64_appliance_dns64_debug.stdout }}" |
| 439 | + |
| 440 | + - name: Write hypervisor info to file |
| 441 | + ansible.builtin.copy: |
| 442 | + dest: "{{ cifmw_basedir }}/logs/hypervisor_info.log" |
| 443 | + content: "{{ _hypervisor_info.stdout }}" |
| 444 | + |
276 | 445 | - name: Ping example.com (delegate to test-node)
|
277 | 446 | delegate_to: test-node
|
278 | 447 | register: _ping_example_com
|
|
0 commit comments