There is a small number of packages that we install as part of
the 'base' task with an ad-hoc call to the package module.
Since we have generic facilities for installing packages and a
generic 'base' pseudo-project that we use for all packages that
are not related to any specific project, we can fold everything
into it and have a single source of truth.
The change requires us to delay user creation, though, because
as part of that we edit the sudoers file, which doesn't exist
until the sudo package has been installed.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
guests/site.yml | 7 +++++--
guests/tasks/base.yml | 11 -----------
guests/vars/mappings.yml | 15 +++++++++++++++
guests/vars/projects/base.yml | 5 +++++
4 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/guests/site.yml b/guests/site.yml
index 4207d4e..d057116 100644
--- a/guests/site.yml
+++ b/guests/site.yml
@@ -14,16 +14,19 @@
tasks:
- # Prepare the base environment
+ # Prepare environment. None of the actions performed here might
+ # depend on packages being installed
- include: tasks/base.yml
- include: tasks/compat.yml
- - include: tasks/user.yml
# Install base packages
- include: tasks/packages.yml
vars:
project: base
+ # Create users. This needs to happen after installing base packages
+ - include: tasks/user.yml
+
# Install build dependencies for each project
- include: tasks/packages.yml
with_items:
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 8d7ff44..5379bf6 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -115,17 +115,6 @@
when:
- package_format == 'pkg'
-- name: Install base packages
- package:
- name: '{{ item }}'
- state: present
- with_items:
- - bash
- - git
- - screen
- - sudo
- - vim
-
- name: Remove unwanted packages
package:
name: '{{ item }}'
diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index 190013e..f6ac801 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -53,6 +53,9 @@ mappings:
pkg: avahi
rpm: avahi-devel
+ bash:
+ default: bash
+
bash-completion:
default: bash-completion
CentOS6:
@@ -107,6 +110,9 @@ mappings:
gettext:
default: gettext
+ git:
+ default: git
+
glib2:
deb: libglib2.0-dev
pkg: glib
@@ -635,6 +641,9 @@ mappings:
rpm: sanlock-devel
Ubuntu12:
+ screen:
+ default: screen
+
scrub:
default: scrub
FreeBSD: diskscrub
@@ -654,6 +663,9 @@ mappings:
rpm: spice-gtk3-devel
CentOS6:
+ sudo:
+ default: sudo
+
unzip:
default: unzip
FreeBSD:
@@ -667,6 +679,9 @@ mappings:
deb: valac
CentOS6:
+ vim:
+ default: vim
+
wget:
default: wget
diff --git a/guests/vars/projects/base.yml b/guests/vars/projects/base.yml
index d82f6b9..94644e4 100644
--- a/guests/vars/projects/base.yml
+++ b/guests/vars/projects/base.yml
@@ -3,10 +3,12 @@ packages:
- autoconf
- automake
- autopoint
+ - bash
- ccache
- cppi
- gcc
- gettext
+ - git
- glibc
- libtool
- libtoolize
@@ -15,3 +17,6 @@ packages:
- perl
- pkg-config
- rpmbuild
+ - screen
+ - sudo
+ - vim
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Mar 21, 2018 at 01:19:57PM +0100, Andrea Bolognani wrote: > There is a small number of packages that we install as part of > the 'base' task with an ad-hoc call to the package module. > > Since we have generic facilities for installing packages and a > generic 'base' pseudo-project that we use for all packages that > are not related to any specific project, we can fold everything > into it and have a single source of truth. > > The change requires us to delay user creation, though, because > as part of that we edit the sudoers file, which doesn't exist > until the sudo package has been installed. > > Signed-off-by: Andrea Bolognani <abologna@redhat.com> > --- > guests/site.yml | 7 +++++-- > guests/tasks/base.yml | 11 ----------- > guests/vars/mappings.yml | 15 +++++++++++++++ > guests/vars/projects/base.yml | 5 +++++ > 4 files changed, 25 insertions(+), 13 deletions(-) > > diff --git a/guests/site.yml b/guests/site.yml > index 4207d4e..d057116 100644 > --- a/guests/site.yml > +++ b/guests/site.yml > @@ -14,16 +14,19 @@ > > tasks: > > - # Prepare the base environment > + # Prepare environment. None of the actions performed here might > + # depend on packages being installed > - include: tasks/base.yml > - include: tasks/compat.yml > - - include: tasks/user.yml > > # Install base packages > - include: tasks/packages.yml > vars: > project: base > > + # Create users. This needs to happen after installing base packages > + - include: tasks/user.yml > + This would be solved by moving the package installation into the base task. Reviewed-by: Pavel Hrdina <phrdina@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, 2018-03-21 at 16:03 +0100, Pavel Hrdina wrote: > > - # Prepare the base environment > > + # Prepare environment. None of the actions performed here might > > + # depend on packages being installed > > - include: tasks/base.yml > > - include: tasks/compat.yml > > - - include: tasks/user.yml > > > > # Install base packages > > - include: tasks/packages.yml > > vars: > > project: base > > > > + # Create users. This needs to happen after installing base packages > > + - include: tasks/user.yml > > + > > This would be solved by moving the package installation into the base > task. Not really: the ordering requirement would still be present, just hidden inside base.yml. You would still need to make sure base.yml is included before user.yml. I guess it's really up to preference, at the end of the day. As mentioned in the other message, I like the flat structure better :) -- Andrea Bolognani / Red Hat / Virtualization -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Mar 21, 2018 at 04:17:48PM +0100, Andrea Bolognani wrote: > On Wed, 2018-03-21 at 16:03 +0100, Pavel Hrdina wrote: > > > - # Prepare the base environment > > > + # Prepare environment. None of the actions performed here might > > > + # depend on packages being installed > > > - include: tasks/base.yml > > > - include: tasks/compat.yml > > > - - include: tasks/user.yml > > > > > > # Install base packages > > > - include: tasks/packages.yml > > > vars: > > > project: base > > > > > > + # Create users. This needs to happen after installing base packages > > > + - include: tasks/user.yml > > > + > > > > This would be solved by moving the package installation into the base > > task. > > Not really: the ordering requirement would still be present, just > hidden inside base.yml. You would still need to make sure base.yml > is included before user.yml. > > I guess it's really up to preference, at the end of the day. As > mentioned in the other message, I like the flat structure better :) Reviewed-by: Pavel Hrdina <phrdina@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
guests/tasks/packages.yml | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/guests/tasks/packages.yml b/guests/tasks/packages.yml
index 807b5c4..a26a94d 100644
--- a/guests/tasks/packages.yml
+++ b/guests/tasks/packages.yml
@@ -1,4 +1,10 @@
---
+# Default to installing packages if state is not passed from the caller
+- set_fact:
+ state: present
+ when:
+ - state is undefined
+
- name: '{{ project }}: Load variables'
include_vars:
file: 'vars/projects/{{ project }}.yml'
@@ -58,9 +64,9 @@
- temp[item] != None
- temp[item] not in flattened
-- name: '{{ project }}: Install packages'
+- name: '{{ project }}: Install/remove packages (state={{ state }})'
package:
name: '{{ item }}'
- state: present
+ state: '{{ state }}'
with_items:
'{{ flattened|sort }}'
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Mar 21, 2018 at 01:19:58PM +0100, Andrea Bolognani wrote: > Signed-off-by: Andrea Bolognani <abologna@redhat.com> > --- > guests/tasks/packages.yml | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) Reviewed-by: Pavel Hrdina <phrdina@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
As with ad-hoc installation, we want to get rid of ad-hoc package
removal. Add a 'blacklist' pseudo-project which can be used for
the purpose.
In the future, we might use this facility to keep long-lived
guests clean by blacklisting packages as they get dropped from
the respective project.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
guests/site.yml | 6 ++++++
guests/tasks/base.yml | 7 -------
guests/vars/mappings.yml | 3 +++
guests/vars/projects/blacklist.yml | 3 +++
4 files changed, 12 insertions(+), 7 deletions(-)
create mode 100644 guests/vars/projects/blacklist.yml
diff --git a/guests/site.yml b/guests/site.yml
index d057116..a00be86 100644
--- a/guests/site.yml
+++ b/guests/site.yml
@@ -24,6 +24,12 @@
vars:
project: base
+ # Remove blacklisted packages
+ - include: tasks/packages.yml
+ vars:
+ project: blacklist
+ state: absent
+
# Create users. This needs to happen after installing base packages
- include: tasks/user.yml
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 5379bf6..0c82b58 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -115,13 +115,6 @@
when:
- package_format == 'pkg'
-- name: Remove unwanted packages
- package:
- name: '{{ item }}'
- state: absent
- with_items:
- - nano
-
- name: Configure hostname
hostname:
name: '{{ inventory_hostname }}'
diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index f6ac801..deae69d 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -400,6 +400,9 @@ mappings:
mingw64-readline:
FedoraRawhide: mingw64-readline
+ nano:
+ default: nano
+
netcf:
deb: libnetcf-dev
rpm: netcf-devel
diff --git a/guests/vars/projects/blacklist.yml b/guests/vars/projects/blacklist.yml
new file mode 100644
index 0000000..e5f369c
--- /dev/null
+++ b/guests/vars/projects/blacklist.yml
@@ -0,0 +1,3 @@
+---
+packages:
+ - nano
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Mar 21, 2018 at 01:19:59PM +0100, Andrea Bolognani wrote: > As with ad-hoc installation, we want to get rid of ad-hoc package > removal. Add a 'blacklist' pseudo-project which can be used for > the purpose. > > In the future, we might use this facility to keep long-lived > guests clean by blacklisting packages as they get dropped from > the respective project. > > Signed-off-by: Andrea Bolognani <abologna@redhat.com> > --- > guests/site.yml | 6 ++++++ > guests/tasks/base.yml | 7 ------- > guests/vars/mappings.yml | 3 +++ > guests/vars/projects/blacklist.yml | 3 +++ > 4 files changed, 12 insertions(+), 7 deletions(-) > create mode 100644 guests/vars/projects/blacklist.yml > > diff --git a/guests/site.yml b/guests/site.yml > index d057116..a00be86 100644 > --- a/guests/site.yml > +++ b/guests/site.yml > @@ -24,6 +24,12 @@ > vars: > project: base > > + # Remove blacklisted packages > + - include: tasks/packages.yml > + vars: > + project: blacklist > + state: absent > + This would probably make sense to have in the base task as well since it prepares the base installation. > # Create users. This needs to happen after installing base packages > - include: tasks/user.yml > > diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml > index 5379bf6..0c82b58 100644 > --- a/guests/tasks/base.yml > +++ b/guests/tasks/base.yml > @@ -115,13 +115,6 @@ > when: > - package_format == 'pkg' > > -- name: Remove unwanted packages > - package: > - name: '{{ item }}' > - state: absent > - with_items: > - - nano > - > - name: Configure hostname > hostname: > name: '{{ inventory_hostname }}' > diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml > index f6ac801..deae69d 100644 > --- a/guests/vars/mappings.yml > +++ b/guests/vars/mappings.yml > @@ -400,6 +400,9 @@ mappings: > mingw64-readline: > FedoraRawhide: mingw64-readline > > + nano: > + default: nano > + > netcf: > deb: libnetcf-dev > rpm: netcf-devel > diff --git a/guests/vars/projects/blacklist.yml b/guests/vars/projects/blacklist.yml > new file mode 100644 > index 0000000..e5f369c > --- /dev/null > +++ b/guests/vars/projects/blacklist.yml > @@ -0,0 +1,3 @@ > +--- > +packages: > + - nano In the past we've installed some packages, that were removed from ansible and it would make sense to list them in the blacklist in order to cleanup existing installations that someone can already have. The list of the removed packages is: polkit-devel glibc-rpcgen on Fedora > 27 (it was glibc-common) Anyway, this can be a followup patch. Reviewed-by: Pavel Hrdina <phrdina@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, 2018-03-21 at 16:11 +0100, Pavel Hrdina wrote: > > +++ b/guests/vars/projects/blacklist.yml > > @@ -0,0 +1,3 @@ > > +--- > > +packages: > > + - nano > > In the past we've installed some packages, that were removed from > ansible and it would make sense to list them in the blacklist in order > to cleanup existing installations that someone can already have. > > The list of the removed packages is: > > polkit-devel > glibc-rpcgen on Fedora > 27 (it was glibc-common) > > Anyway, this can be a followup patch. The rpcgen stuff is pretty confusing, even though I'm the one who made the change :) Anyway, glibc-rpcgen no longer seems to exist in rawhide, while glibc-common can't be removed because packages depend on it, so I guess there's no cleaning up required there. As for polkit-devel, I'm trying to figure out a nice way to add it to the blacklist... The current naming convention is along the lines of foo: deb: libfoo-dev rpm: foo-devel so it doesn't fit neatly in there, because we want to blacklist polkit-devel but still install polkit itself. Maybe we could have blacklist-polkit: rpm: polkit-devel or something similar as a workaround? Does that look reasonable? Alternatively we can just leave the package installed, of course :) -- Andrea Bolognani / Red Hat / Virtualization -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, Mar 22, 2018 at 11:18:17AM +0100, Andrea Bolognani wrote: > On Wed, 2018-03-21 at 16:11 +0100, Pavel Hrdina wrote: > > > +++ b/guests/vars/projects/blacklist.yml > > > @@ -0,0 +1,3 @@ > > > +--- > > > +packages: > > > + - nano > > > > In the past we've installed some packages, that were removed from > > ansible and it would make sense to list them in the blacklist in order > > to cleanup existing installations that someone can already have. > > > > The list of the removed packages is: > > > > polkit-devel > > glibc-rpcgen on Fedora > 27 (it was glibc-common) > > > > Anyway, this can be a followup patch. > > The rpcgen stuff is pretty confusing, even though I'm the one who > made the change :) Anyway, glibc-rpcgen no longer seems to exist in > rawhide, while glibc-common can't be removed because packages depend > on it, so I guess there's no cleaning up required there. Nothing should have depended on glibc-rpcgen at all - it was just a temporary hack - any dep should have been on "rpcgen" (glibc-rpcgen provided that as a virutal Provides), and the new RPM has that correct name. Prior to F27 just glibc-common is right. > > As for polkit-devel, I'm trying to figure out a nice way to add it > to the blacklist... The current naming convention is along the > lines of > > foo: > deb: libfoo-dev > rpm: foo-devel > > so it doesn't fit neatly in there, because we want to blacklist > polkit-devel but still install polkit itself. Maybe we could have > > blacklist-polkit: > rpm: polkit-devel > > or something similar as a workaround? Does that look reasonable? > > Alternatively we can just leave the package installed, of course :) > > -- > Andrea Bolognani / Red Hat / Virtualization > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, 2018-03-22 at 10:31 +0000, Daniel P. Berrangé wrote: > > > The list of the removed packages is: > > > > > > polkit-devel > > > glibc-rpcgen on Fedora > 27 (it was glibc-common) > > > > The rpcgen stuff is pretty confusing, even though I'm the one who > > made the change :) Anyway, glibc-rpcgen no longer seems to exist in > > rawhide, while glibc-common can't be removed because packages depend > > on it, so I guess there's no cleaning up required there. > > Nothing should have depended on glibc-rpcgen at all - it was just a > temporary hack - any dep should have been on "rpcgen" (glibc-rpcgen > provided that as a virutal Provides), and the new RPM has that correct > name. Prior to F27 just glibc-common is right. Yeah, we used glibc-rpcgen at first (3a559ae7bc08) but immediately changed it to rpcgen (1d9a55d33459). So luckily we don't have to worry about that. -- Andrea Bolognani / Red Hat / Virtualization -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, Mar 22, 2018 at 11:18:17AM +0100, Andrea Bolognani wrote: > On Wed, 2018-03-21 at 16:11 +0100, Pavel Hrdina wrote: > > > +++ b/guests/vars/projects/blacklist.yml > > > @@ -0,0 +1,3 @@ > > > +--- > > > +packages: > > > + - nano > > > > In the past we've installed some packages, that were removed from > > ansible and it would make sense to list them in the blacklist in order > > to cleanup existing installations that someone can already have. > > > > The list of the removed packages is: > > > > polkit-devel > > glibc-rpcgen on Fedora > 27 (it was glibc-common) > > > > Anyway, this can be a followup patch. > > The rpcgen stuff is pretty confusing, even though I'm the one who > made the change :) Anyway, glibc-rpcgen no longer seems to exist in > rawhide, while glibc-common can't be removed because packages depend > on it, so I guess there's no cleaning up required there. > > As for polkit-devel, I'm trying to figure out a nice way to add it > to the blacklist... The current naming convention is along the > lines of > > foo: > deb: libfoo-dev > rpm: foo-devel > > so it doesn't fit neatly in there, because we want to blacklist > polkit-devel but still install polkit itself. Maybe we could have > > blacklist-polkit: > rpm: polkit-devel > > or something similar as a workaround? Does that look reasonable? > > Alternatively we can just leave the package installed, of course :) I guess that it can be done as a followup patch so Reviewed-by: Pavel Hrdina <phrdina@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
We only need jessie-backports for the JDK, and we only need the
JDK for the Jenkins agent.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
guests/tasks/base.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 0c82b58..debf6e4 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -75,6 +75,7 @@
when:
- os_name == 'Debian'
- os_version == '8'
+ - flavor == 'jenkins'
- name: Configure APT pinning for jessie-backports
copy:
@@ -85,6 +86,7 @@
when:
- os_name == 'Debian'
- os_version == '8'
+ - flavor == 'jenkins'
- name: Enable fedora-rawhide-kernel-nodebug repository
copy:
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Mar 21, 2018 at 01:20:00PM +0100, Andrea Bolognani wrote: > We only need jessie-backports for the JDK, and we only need the > JDK for the Jenkins agent. > > Signed-off-by: Andrea Bolognani <abologna@redhat.com> > --- > guests/tasks/base.yml | 2 ++ > 1 file changed, 2 insertions(+) Reviewed-by: Pavel Hrdina <phrdina@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
We already have a separate task for creating the non-root user,
so it makes sense to move everything related to the root user to
that taks as well.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
guests/site.yml | 2 +-
guests/tasks/base.yml | 20 --------------------
guests/tasks/{user.yml => users.yml} | 20 ++++++++++++++++++++
3 files changed, 21 insertions(+), 21 deletions(-)
rename guests/tasks/{user.yml => users.yml} (67%)
diff --git a/guests/site.yml b/guests/site.yml
index a00be86..351e575 100644
--- a/guests/site.yml
+++ b/guests/site.yml
@@ -31,7 +31,7 @@
state: absent
# Create users. This needs to happen after installing base packages
- - include: tasks/user.yml
+ - include: tasks/users.yml
# Install build dependencies for each project
- include: tasks/packages.yml
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index debf6e4..33681b4 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -121,26 +121,6 @@
hostname:
name: '{{ inventory_hostname }}'
-- name: Configure ssh access for the root user
- authorized_key:
- user: root
- key: '{{ lookup("file", lookup("env", "HOME") + "/.ssh/id_rsa.pub") }}'
- state: present
-
-- name: Configure root password and shell
- user:
- name: root
- password: '{{ lookup("file", root_password_file) }}'
- shell: '{{ bash }}'
-
-- name: Disable password authentication for the root user
- lineinfile:
- path: /etc/ssh/sshd_config
- regexp: '^#*\s*PermitRootLogin\s*.*$'
- line: 'PermitRootLogin without-password'
- state: present
- backup: yes
-
- name: Look for GRUB2 configuration
stat:
path: /etc/default/grub
diff --git a/guests/tasks/user.yml b/guests/tasks/users.yml
similarity index 67%
rename from guests/tasks/user.yml
rename to guests/tasks/users.yml
index 3db5258..6134228 100644
--- a/guests/tasks/user.yml
+++ b/guests/tasks/users.yml
@@ -1,4 +1,24 @@
---
+- name: 'root: Set password'
+ user:
+ name: root
+ password: '{{ lookup("file", root_password_file) }}'
+ shell: '{{ bash }}'
+
+- name: 'root: Configure ssh access'
+ authorized_key:
+ user: root
+ key: '{{ lookup("file", lookup("env", "HOME") + "/.ssh/id_rsa.pub") }}'
+ state: present
+
+- name: 'root: Disable ssh password authentication'
+ lineinfile:
+ path: /etc/ssh/sshd_config
+ regexp: '^#*\s*PermitRootLogin\s*.*$'
+ line: 'PermitRootLogin without-password'
+ state: present
+ backup: yes
+
- name: '{{ flavor }}: Create user account'
user:
name: '{{ flavor }}'
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Mar 21, 2018 at 01:20:01PM +0100, Andrea Bolognani wrote: > We already have a separate task for creating the non-root user, > so it makes sense to move everything related to the root user to > that taks as well. > > Signed-off-by: Andrea Bolognani <abologna@redhat.com> > --- > guests/site.yml | 2 +- > guests/tasks/base.yml | 20 -------------------- > guests/tasks/{user.yml => users.yml} | 20 ++++++++++++++++++++ > 3 files changed, 21 insertions(+), 21 deletions(-) > rename guests/tasks/{user.yml => users.yml} (67%) Reviewed-by: Pavel Hrdina <phrdina@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
There are enough bootloader tweaks that splitting them off to
a separate task makes sense.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
guests/site.yml | 1 +
guests/tasks/base.yml | 53 ---------------------------------------------
guests/tasks/bootloader.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 54 insertions(+), 53 deletions(-)
create mode 100644 guests/tasks/bootloader.yml
diff --git a/guests/site.yml b/guests/site.yml
index 351e575..ceaaf25 100644
--- a/guests/site.yml
+++ b/guests/site.yml
@@ -17,6 +17,7 @@
# Prepare environment. None of the actions performed here might
# depend on packages being installed
- include: tasks/base.yml
+ - include: tasks/bootloader.yml
- include: tasks/compat.yml
# Install base packages
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 33681b4..53cbd65 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -120,56 +120,3 @@
- name: Configure hostname
hostname:
name: '{{ inventory_hostname }}'
-
-- name: Look for GRUB2 configuration
- stat:
- path: /etc/default/grub
- register: grubdefault
-
-- name: Look for GRUB2 configuration
- stat:
- path: /boot/grub/grub.cfg
- register: grubcfg
-
-- name: Look for GRUB2 configuration
- stat:
- path: /boot/grub2/grub.cfg
- register: grub2cfg
-
-- name: Configure GRUB2
- 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 GRUB2 configuration
- command: 'grub-mkconfig -o /boot/grub/grub.cfg'
- when:
- - grubcfg.stat.exists
-
-- name: Apply GRUB2 configuration
- command: 'grub2-mkconfig -o /boot/grub2/grub.cfg'
- when:
- - grub2cfg.stat.exists
-
-- name: Configure the FreeBSD bootloader
- lineinfile:
- path: /boot/loader.conf
- regexp: '^{{ item.key }}=.*$'
- line: '{{ item.key }}="{{ item.value }}"'
- create: yes
- backup: yes
- with_items:
- - { key: 'console', value: 'comconsole' }
- - { key: 'autoboot_delay', value: '1' }
- when:
- - os_name == 'FreeBSD'
diff --git a/guests/tasks/bootloader.yml b/guests/tasks/bootloader.yml
new file mode 100644
index 0000000..face3dd
--- /dev/null
+++ b/guests/tasks/bootloader.yml
@@ -0,0 +1,53 @@
+---
+- name: Look for GRUB2 configuration
+ stat:
+ path: /etc/default/grub
+ register: grubdefault
+
+- name: Look for GRUB2 configuration
+ stat:
+ path: /boot/grub/grub.cfg
+ register: grubcfg
+
+- name: Look for GRUB2 configuration
+ stat:
+ path: /boot/grub2/grub.cfg
+ register: grub2cfg
+
+- name: Configure GRUB2
+ 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 GRUB2 configuration
+ command: 'grub-mkconfig -o /boot/grub/grub.cfg'
+ when:
+ - grubcfg.stat.exists
+
+- name: Apply GRUB2 configuration
+ command: 'grub2-mkconfig -o /boot/grub2/grub.cfg'
+ when:
+ - grub2cfg.stat.exists
+
+- name: Configure the FreeBSD bootloader
+ lineinfile:
+ path: /boot/loader.conf
+ regexp: '^{{ item.key }}=.*$'
+ line: '{{ item.key }}="{{ item.value }}"'
+ create: yes
+ backup: yes
+ with_items:
+ - { key: 'console', value: 'comconsole' }
+ - { key: 'autoboot_delay', value: '1' }
+ when:
+ - os_name == 'FreeBSD'
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Mar 21, 2018 at 01:20:02PM +0100, Andrea Bolognani wrote: > There are enough bootloader tweaks that splitting them off to > a separate task makes sense. > > Signed-off-by: Andrea Bolognani <abologna@redhat.com> > --- > guests/site.yml | 1 + > guests/tasks/base.yml | 53 --------------------------------------------- > guests/tasks/bootloader.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 54 insertions(+), 53 deletions(-) > create mode 100644 guests/tasks/bootloader.yml Reviewed-by: Pavel Hrdina <phrdina@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.