blob: f9cc7725a895852d6d6b0c80cc8404b2452eb201 (
plain)
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
|
- name: Create GRUB directory
become: true
file:
path: "{{ vyos_install_root }}/boot/grub"
state: directory
# It is necessary to mount and bind /dev, /proc, /sys and /boot in order to execute grub-install
# and install GRUB correctly within the {{ volume_drive }} using chroot
# XXX: ansible mount module requires fstype so it cannot be used for binding an already
# mounted location, we get to use mount directly at least for /boot
- name: Mount and bind /dev /proc /sys and {{ vyos_write_root }}/boot to {{ vyos_install_root }}
become: true
shell: mount --bind /dev {{ vyos_install_root }}/dev &&
mount --bind /proc {{ vyos_install_root }}/proc &&
mount --bind /sys {{ vyos_install_root }}/sys &&
mount --bind {{ vyos_write_root }} {{ vyos_install_root }}/boot
args:
warn: no
- name: Mount EFI
mount:
src: "{{ vyos_target_drive }}p2"
path: "{{ vyos_install_root }}/boot/efi"
fstype: vfat
state: mounted
- name: Install GRUB in the boot sector of {{ vyos_target_drive }}
become: true
command: "chroot {{ vyos_install_root }} grub-install --no-floppy --root-directory=/boot {{ vyos_grub_drive }} --force"
args:
creates: "{{ vyos_install_root }}/boot/grub/grubenv"
- name: Install EFI GRUB to {{ vyos_target_drive }}p2
become: true
command: "chroot {{ vyos_install_root }} grub-install --no-floppy --recheck --target=x86_64-efi --force-extra-removable --root-directory=/boot --efi-directory=/boot/efi --bootloader-id='VyOS' --no-uefi-secure-boot"
- name: Configure GRUB
become: true
template:
src: templates/boot/grub/grub.cfg.j2
dest: "{{ vyos_write_root }}/boot/grub/grub.cfg"
mode: 0644
- name: Unmount EFI
mount:
src: "{{ vyos_target_drive }}p2"
path: "{{ vyos_install_root }}/boot/efi"
fstype: vfat
state: absent
|