summaryrefslogtreecommitdiffstats
path: root/roles/bootstrap/tasks
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-04-20 14:43:52 +0200
committerAhmed Abdelhalim <[email protected]>2026-04-20 14:48:09 +0200
commit8ee10fb59163977fb95fa688fcd6ee2409b48f02 (patch)
treef1c285250060eb74a0315b53b9424e808289b19a /roles/bootstrap/tasks
parent5c2f4c0d74bcc321f3c34526c427456d3b03e9b9 (diff)
Add mac ubuntu install tasks
Add the hack scripts to download and install wifi drivers on Mac For ubuntu ISO, unlike archlinux, it doesn't ship with the wl drivers required for wifi to work on ubuntu, this is a hack workaround to download the missing dependencies on an external USB and use it on the Live ISO to install the missing drivers, allowing for the rest of automation to take place. Assisted-by: Claude (Sonnet 4.6)
Diffstat (limited to 'roles/bootstrap/tasks')
-rw-r--r--roles/bootstrap/tasks/install-ubuntu-mac.yml74
-rw-r--r--roles/bootstrap/tasks/install-ubuntu.yml6
-rw-r--r--roles/bootstrap/tasks/main.yml3
3 files changed, 79 insertions, 4 deletions
diff --git a/roles/bootstrap/tasks/install-ubuntu-mac.yml b/roles/bootstrap/tasks/install-ubuntu-mac.yml
new file mode 100644
index 0000000..005c403
--- /dev/null
+++ b/roles/bootstrap/tasks/install-ubuntu-mac.yml
@@ -0,0 +1,74 @@
+---
+# Apple EFI 1.x does not expose ext4 volumes via SimpleFileSystem, so the
+# kernel must live on the FAT32 EFI partition where rEFInd already scans \boot\.
+- name: "Ensure boot directory exists on EFI partition"
+ ansible.builtin.file:
+ path: "{{ mnt_boot_path }}/boot"
+ state: directory
+ mode: "0755"
+
+- name: "Copy kernel to EFI partition"
+ ansible.builtin.copy:
+ src: "{{ mnt_root_path }}/boot/{{ item }}"
+ dest: "{{ mnt_boot_path }}/boot/{{ item }}"
+ remote_src: true
+ follow: true
+ mode: "0644"
+ loop:
+ - "vmlinuz"
+ - "initrd.img"
+
+- name: "Configure rEFInd boot options on EFI partition"
+ ansible.builtin.template:
+ src: "refind_linux.conf.j2"
+ dest: "{{ mnt_boot_path }}/boot/refind_linux.conf"
+ mode: "0644"
+
+- name: "Ensure kernel post-install hook directory exists"
+ ansible.builtin.file:
+ path: "{{ mnt_root_path }}/etc/kernel/postinst.d"
+ state: directory
+ mode: "0755"
+
+- name: "Install kernel sync script for EFI partition"
+ ansible.builtin.copy:
+ dest: "{{ mnt_root_path }}/etc/kernel/postinst.d/refind-sync-kernel"
+ mode: "0755"
+ content: |
+ #!/bin/sh
+ cp /boot/vmlinuz /boot/efi/boot/
+ cp /boot/initrd.img /boot/efi/boot/
+
+- name: "Install bcmwl-kernel-source in chroot"
+ ansible.builtin.command:
+ cmd: "arch-chroot {{ mnt_root_path }} apt-get install -y bcmwl-kernel-source"
+ environment:
+ MAKEFLAGS: ""
+ changed_when: true
+ failed_when: false
+
+- name: "Configure unconfigured packages in chroot"
+ ansible.builtin.command:
+ cmd: "arch-chroot {{ mnt_root_path }} dpkg --configure -a"
+ environment:
+ MAKEFLAGS: ""
+ changed_when: true
+ failed_when: false
+
+- name: "Blacklist modules conflicting with broadcom-wl"
+ ansible.builtin.copy:
+ dest: "{{ mnt_root_path }}/etc/modprobe.d/broadcom-wl.conf"
+ mode: "0644"
+ content: |
+ blacklist brcmfmac
+ blacklist brcmutil
+ blacklist b43
+ blacklist ssb
+ blacklist bcma
+
+- name: "Load wl module at boot"
+ ansible.builtin.lineinfile:
+ path: "{{ mnt_root_path }}/etc/modules"
+ line: "wl"
+ create: true
+ mode: "0644"
diff --git a/roles/bootstrap/tasks/install-ubuntu.yml b/roles/bootstrap/tasks/install-ubuntu.yml
index a121fe8..3c18b0e 100644
--- a/roles/bootstrap/tasks/install-ubuntu.yml
+++ b/roles/bootstrap/tasks/install-ubuntu.yml
@@ -55,12 +55,10 @@
changed_when: true
- name: "Configure rEFInd boot options"
- ansible.builtin.copy:
+ ansible.builtin.template:
+ src: "refind_linux.conf.j2"
dest: "{{ mnt_root_path }}/boot/refind_linux.conf"
mode: "0644"
- content: |
- "Boot with defaults" "root=PARTLABEL={{ partition_root.name }} rw"
- "Boot to terminal" "root=PARTLABEL={{ partition_root.name }} rw systemd.unit=multi-user.target"
- name: "Configure rEFInd settings"
ansible.builtin.copy:
diff --git a/roles/bootstrap/tasks/main.yml b/roles/bootstrap/tasks/main.yml
index cb92f99..50e2ce2 100644
--- a/roles/bootstrap/tasks/main.yml
+++ b/roles/bootstrap/tasks/main.yml
@@ -20,6 +20,9 @@
- name: "Install ubuntu"
ansible.builtin.include_tasks: "install-ubuntu.yml"
when: ansible_facts['distribution'] == "Ubuntu"
+ - name: "Install ubuntu on Mac"
+ ansible.builtin.include_tasks: "install-ubuntu-mac.yml"
+ when: ansible_facts['distribution'] == "Ubuntu" and bootstrap_mac
- name: "Install raspberry"
ansible.builtin.include_tasks: "install-raspberry.yml"