blob: 407da3c5c3d95359c49289ab5e41aa418896ae91 (
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
|
---
- name: "Include distribution vars"
ansible.builtin.include_vars: "{{ ansible_distribution | lower }}.yml"
- name: "Ensure install dependencies are installed on live environment"
ansible.builtin.apt:
state: "present"
update_cache: true
pkg:
- "debootstrap"
- "arch-install-scripts"
- "bash"
- name: "Run debootstrap"
ansible.builtin.command:
cmd: "debootstrap
{{ bootstrap_opts }}
{{ bootstrap_distro.name }}
{{ mnt_root_path }}
{{ bootstrap_distro.mirror_url }}"
changed_when: true
- name: "Generate fstab"
ansible.builtin.shell:
cmd: "genfstab -t PARTLABEL {{ mnt_root_path }} > {{ mnt_root_path }}/etc/fstab"
changed_when: true
- name: "Configure apt in chroot"
ansible.builtin.copy:
dest: "{{ item.dest }}"
mode: "0640"
content: "{{ item.content }}"
loop:
- dest: "{{ mnt_root_path }}/etc/apt/preferences.d/ignored-package"
content: "{{ bootstrap_apt_ignored_preferences }}"
- dest: "{{ mnt_root_path }}/etc/apt/sources.list"
content: "{{ bootstrap_apt_sources }}"
- name: "Configure system in chroot"
ansible.builtin.command:
cmd: "arch-chroot {{ mnt_root_path }} {{ item }}"
changed_when: true
loop:
- "apt-get update"
- "apt-get install -y {{ bootstrap_distro.packages | join(' ') }}"
- name: "Clean up old Linux Boot Manager entries"
ansible.builtin.shell:
cmd: |
for entry in $(efibootmgr | grep "Linux Boot Manager" | cut -d'*' -f1 | tr -d 'Boot'); do
efibootmgr -b $entry -B
done
changed_when: false
failed_when: false
# NOTE: bootctl is not run in chroot to workaround https://github.com/systemd/systemd/issues/36174
- name: "Run bootctl"
ansible.builtin.command:
cmd: "bootctl install --esp-path={{ mnt_boot_path }}"
changed_when: true
|