libvirt_cloud/roles/ansible-gentoo_install/tasks/bootloader.yml

109 lines
3.3 KiB
YAML

# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-
---
- name: "DEBUG: ansible-gentoo_install bootloader"
debug:
verbosity: 1
msg: "DEBUG: ansible-gentoo_install bootloader"
- name: test we are in the chroot
shell: |
df | grep {{AGI_NBD_MP}} && exit 1
check_mode: false
- name: install grub
portage:
package: sys-boot/grub:2
state: installed
- name: install grub to MBR
command: grub-install {{ AGI_install_disk }}
args:
creates: /boot/grub
- name: generate grub config
shell: grub-mkconfig -o /boot/grub/grub.cfg
args:
creates: /boot/grub/grub.cfg
- name: edit grub config
shell: |
[ -f /etc/default/grub.dst ] || cp -p /etc/default/grub /etc/default/grub.dst
a=$(cat /proc/cmdline | sed -e 's/ BOOT_IMAGE=[^ ]*/ /' \
-e 's/ initrd=[^ ]*/ /'
-e 's/ resume=[^ ]*/ /'
-e 's/ root=[^ ]*/ /')
sed -e "s/^#*GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"$a\"/" \
-i /etc/default/grub
grub-script-check /etc/default/grub
- name: fstab root
lineinfile:
dest: /etc/fstab
line: '{{AGI_container_disk}}3 / ext4 defaults,noatime 0 1'
regexp: '^{{AGI_container_disk}}3'
- name: fstab boot
lineinfile:
dest: /etc/fstab
line: '{{AGI_container_disk}}1 /boot ext3 defaults,noatime 0 1'
regexp: '^{{AGI_container_disk}}3'
- name: fstab swap
lineinfile:
dest: /etc/fstab
line: '{{AGI_container_disk}}2 none swap nofail,sw 0 0'
regexp: '^{{AGI_container_disk}}2'
- name: fstab shm
lineinfile:
dest: /etc/fstab
line: 'tmpfs /run/shm tmpfs defaults,noexec,size=5% 0 0'
regexp: '^tmpfs */run/shm'
# linuxPen19 /mnt/linuxPen19 virtiofs defaults,dirsync 0 0
- name: /etc/security/passwdqc.conf
lineinfile:
dest: /etc/security/passwdqc.conf
line: 'enforce=none'
regexp: '^enforce=.*'
- name: /etc/security/passwdqc.conf
lineinfile:
dest: /etc/security/passwdqc.conf
line: 'enforce=none'
regexp: '^enforce=.*'
- name: /etc/conf.d/consolefont
lineinfile:
dest: /etc/conf.d/consolefont
line: 'consolefont="ter-v{{AGI_consolefont_font_size}}b"'
regexp: '^consolefont=.*'
- name: roles/ansible-gentoo_install/tasks/
shell: |
LINE="rd.skipfsck=1 ipv6.disable=1 console=tty1 lang=en keymap=us "
# LINE="$LINE pti=on doscsi iommu=pt amd_iommu=on debugfs=off efi=disable_early_pci_dma extra_latent_entropy init_on_free=1 kvm.nx_huge_pages=force l1tf=full,force mce=0 mds=full,nosmt nosmt=force page_alloc.shuffle=1 pti=on random.trust_cpu=off slab_nomerge slub_debug=FZ spec_store_bypass_disable=on spectre_v2=on tsx_async_abort=full,nosmt vsyscall=none "
LINE="$LINE intel_iommu=on vga=0x315 text
df | grep /boot || mount /dev/vda1 /boot
[ -d /boot/grub ] || exit 2
[ -f /boot/grub/grub.cfg ] || exit 3
sed -e "s@ ro *$@ $LINE ro@" -i /boot/grub/grub.cfg
- name: consolefont
shell: |
rc-update add consolefont
cat >> /etc/rc.local << EOF
/etc/init.d consolefont stop
/etc/init.d consolefont start
stty -F /dev/tty1 cols 80 rows 24
EOF
bash /etc/rc.local
ignore_errors: true
- name: rc-update add bootlogd boot
shell: |
rc-update | grep -q 'bootlogd .* boot' || \
rc-update add bootlogd boot
exit 0