[libvirt] [libvirt-jenkins-ci PATCH v2 5/6] guests: Configure bootloaders

Pavel Hrdina phrdina at redhat.com
Thu Oct 19 11:29:34 UTC 2017


On Wed, Oct 18, 2017 at 07:11:50PM +0200, Andrea Bolognani wrote:
> Both GRUB and the FreeBSD bootloader need some tweaking to make
> sure the OS will display boot messages and provide a login prompt
> on the serial console, which is useful when SSH access can't be
> used for whatever reason.
> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  guests/tasks/base.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
> index a9066e4..db805b8 100644
> --- a/guests/tasks/base.yml
> +++ b/guests/tasks/base.yml
> @@ -115,3 +115,53 @@
>      line: 'PermitRootLogin without-password'
>      state: present
>      backup: yes
> +
> +- name: Look for GRUB configuration
> +  stat:
> +    path: /etc/default/grub
> +  register: grubdefault
> +
> +- name: Look for GRUB configuration
> +  stat:
> +    path: /boot/grub/grub.cfg
> +  register: grubcfg
> +
> +- name: Look for GRUB configuration

s/GRUB/GRUB2/

> +  stat:
> +    path: /boot/grub2/grub.cfg
> +  register: grub2cfg
> +
> +- name: Configure GRUB
> +  lineinfile:
> +    path: /etc/default/grub
> +    regexp: '^{{ item.key }}=.*$'
> +    line: '{{ item.key }}="{{ item.value }}"'
> +    backup: yes
> +  with_items:
> +    - { key: 'GRUB_TIMEOUT', value: '1' }
> +    - { key: 'GRUB_CMDLINE_LINUX_DEFAULT', value: 'console=ttyS0' }
> +    - { key: 'GRUB_CMDLINE_LINUX', value: 'console=ttyS0' }
> +    - { key: 'GRUB_TERMINAL', value: 'serial' }
> +    - { key: 'GRUB_SERIAL_COMMAND', value: 'serial' }
> +  when:
> +    - grubdefault.stat.exists
> +
> +- name: Apply GRUB configuration
> +  command: 'grub-mkconfig -o /boot/grub/grub.cfg'
> +  when:
> +    - grubcfg.stat.exists
> +
> +- name: Apply GRUB configuration

s/GRUB/GRUB2/

> +  command: 'grub2-mkconfig -o /boot/grub2/grub.cfg'
> +  when:
> +    - grub2cfg.stat.exists
> +
> +- name: Configure the FreeBSD bootloader
> +  lineinfile:
> +    path: /boot/loader.conf
> +    regexp: '^console=.*$'
> +    line: 'console="comconsole"'
> +    create: yes
> +    backup: yes
> +  when:
> +    - os_name == 'FreeBSD'
> -- 
> 2.13.6
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20171019/9982de15/attachment-0001.sig>


More information about the libvir-list mailing list