diff options
author | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2018-06-28 01:23:02 +0900 |
---|---|---|
committer | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2018-06-28 01:23:02 +0900 |
commit | 86f71d4334f2269ff8f0268d200f03b73e1c26b7 (patch) | |
tree | 1fe8415733cdf993549ae6bcf067f4ea6c272e03 /roles/install-grub/tasks/main.yml | |
parent | ebf269e8926d3dbd2a543aabe598ef4cfa68a5ff (diff) | |
download | vyos-vm-images-86f71d4334f2269ff8f0268d200f03b73e1c26b7.tar.gz vyos-vm-images-86f71d4334f2269ff8f0268d200f03b73e1c26b7.zip |
Cleanup playbook
Diffstat (limited to 'roles/install-grub/tasks/main.yml')
-rw-r--r-- | roles/install-grub/tasks/main.yml | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/roles/install-grub/tasks/main.yml b/roles/install-grub/tasks/main.yml new file mode 100644 index 0000000..2a20271 --- /dev/null +++ b/roles/install-grub/tasks/main.yml @@ -0,0 +1,32 @@ +- name: Create GRUB directory + become: true + file: + path: "{{ vyos_write_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: 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_target_drive }} --force + args: + creates: "{{ vyos_install_root }}/boot/grub/grubenv" + +- name: Configure GRUB + become: true + template: + src: templates/boot/grub/grub.cfg.j2 + dest: "{{ vyos_write_root }}/boot/grub/grub.cfg" + mode: 0644 |