summaryrefslogtreecommitdiffstats
path: root/molecule/default/converge.yml
blob: ee029024f108de6a809ebeb6e3a34d0d946f19c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
- name: "Discover test devices"
  hosts: localhost
  gather_facts: false
  vars:
    distro_key: "{{ lookup('ansible.builtin.env', 'MOLECULE_DISTRO') }}"
    scenario_vars:
      archlinux:
        hostname: "desktop.local"
      ubuntu-noble:
        hostname: "laptop.local"
      ubuntu-resolute:
        hostname: "laptop.local"
      raspberrypi:
        hostname: "rpi5.local"
        bootstrap_pi: true
      proxmox:
        hostname: "pve.local"
        bootstrap_proxmox: true
  tasks:
    - name: "Find loop device for vdd.img"
      become: true
      ansible.builtin.command:
        cmd: "losetup -j /opt/vdd.img"
      register: losetup_output
      changed_when: false

    - name: "Inject test vars into instance host"
      ansible.builtin.add_host:
        name: "instance"
        test_device: "{{ losetup_output.stdout.split(':')[0] }}"
        test_hostname: "{{ scenario_vars[distro_key].hostname }}"
        test_bootstrap_pi: "{{ scenario_vars[distro_key].bootstrap_pi | default(false) }}"
        test_bootstrap_proxmox: "{{ scenario_vars[distro_key].bootstrap_proxmox | default(false) }}"

- name: Converge
  hosts: instance
  gather_facts: true
  vars:
    hostname: "{{ test_hostname }}"
    partition_wipe: false
    partition_disk: "{{ test_device }}"
    partition_boot:
      num: 1
      name: "boot"
      flags: [boot, esp]
      part_start: "0%"
      part_end: "1.0GiB"
      fstype: "vfat"
      fstype_opts: "-F 32"
      dev: "{{ partition_disk }}p1"
      mount_path: "/mnt/boot/efi"
      fstab_opts: "defaults,nodev,nosuid,noexec,umask=0077"
    partition_swap:
      num: 2
      name: "swap"
      flags: [swap]
      part_start: "1.0GiB"
      part_end: "2.0GiB"
      fstype: "ext4"
      dev: "{{ partition_disk }}p2"
      mount_path: "none"
    partition_root:
      num: 3
      name: "root"
      part_start: "2.0GiB"
      part_end: "100%"
      fstype: "ext4"
      dev: "{{ partition_disk }}p3"
      mount_path: "/mnt"
    partition_extras: []
    bootstrap_pi: "{{ test_bootstrap_pi }}"
    bootstrap_proxmox: "{{ test_bootstrap_proxmox }}"
    configure_playbook_dir: "../../../ansible-distro-configure"
  roles:
    - role: partition
    - role: bootstrap
    - role: configure