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

2017-10-19 Thread Pavel Hrdina
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 
> ---
>  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@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

2017-10-18 Thread Andrea Bolognani
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 
---
 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
+  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
+  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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list