Chef Cookbook for Spacewalk server and clients
I wrote two cookbooks to work with Spacewalk and submitted them to Chefs supermarket.
- Installing Spacewalk server https://supermarket.chef.io/cookbooks/spacewalk-server
- Registering a node (RHEL/CentOS/Ubuntu) as a Spacewalk client https://supermarket.chef.io/cookbooks/spacewalk-client
Read on after the jump how to use these cookbooks. I promise its really simple tho
Server
In your run_list include
for a basic Spacewalk server installation. Be sure to set all attributes mentioned in the README.md
You can also include
for setting up Ubuntu channel syncing and Ubuntu Errata. You have to set some extra attributes for this. Like the apt repository URLs to sync in.
Support for RHEL Errata will follow soon.
Client
Using the client cookbook is also easy. Just include depending on your client system
# OR
spacewalk-client::ubuntu
and set
default['spacewalk']['reg']['server'] = "my_spacewalk_server"
You have to put the following debs to default[‘spacewalk’][‘pkg_source_path’] because they arent in the official repos:
- apt-transport-spacewalk-1.0.6-2.all-deb.deb
- python-ethtool-0.11-2.amd64-deb.deb
- python-rhn-2.5.55-2.all-deb.deb
- rhn-client-tools-1.8.26-3.amd64-deb.deb
- rhnsd-5.0.4-3.amd64-deb.debRead here how to build them yourself
Hello Phil
I am currently installing spacewalk-server with your chef cookbook. Thank you very much for your work it is very useful.
I am working on Linux CENTOS 7.3.1611 (linux Kernel : 3.10.0-327.el7.x86_64)
spacewalk versions :
* install version 2.6-0.el7 of package spacewalk-repo
* install version 2.6.2-1.el7 of package spacewalk-setup-postgresql
* install version 2.6.1-1.el7 of package spacewalk-postgresql
I just wanted to inform you about 2 points that I noticed during the installation. And maybe you can change your cookbook to fix it.
1 – I Modified /usr/bin/spacewalk-setup-postgresql script because I have an error on isSUSE function (not found) (just need to be declared before using it)
2 – I also Changed /var/lib/pgsql/data/pg_hba.conf to add the following access
“host spaceschema spaceuser 127.0.0.1/8 md5” otherwise I have connection issue during the installation (Could not connect to the database. Your connection information may be incorrect. Error: DBI connect(‘dbname=spaceschema;host=localhost;port=5432′,’spaceuser’,…) failed: FATAL: no pg_hba.conf entry for host “127.0.0.1”, user “spaceuser”, database “spaceschema”, SSL off at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1686.)
3 – And the last (but not least) and I have a big issue: the installation process never end :
spacewalk-setup –skip-db-diskspace-check –skip-db-install –answer-file=/var/cache/chef/spacewalk-answers.conf
* Loading answer file: /var/cache/chef/spacewalk-answers.conf.
* Setting up SELinux..
** Database: Setting up database connection for PostgreSQL backend.
** Database: Embedded database installation SKIPPED.
** Database: Populating database.
The Database has schema. Would you like to clear the database [Y]? N
** Database: The database already has schema. Skipping database population.
* Configuring tomcat.
* Setting up users and groups.
** GPG: Initializing GPG and importing key.
* Performing initial configuration.
* Configuring apache SSL virtual host.
* Configuring jabberd.
* Creating SSL certificates.
** SSL: Generating CA certificate.
** SSL: Deploying CA certificate.
** SSL: Generating server certificate.
** SSL: Storing SSL certificates.
* Deploying configuration files.
* Update configuration in database.
* Setting up Cobbler..
* Restarting services.
(( # ))
Did you already observe that ? if yes, have you got a solution or a workaround ?
Thank you in advance
Hi Olivier,
I’m not working with SW anymore in production. However I last updated the SW-server cookbook this year in March for SW 2.6 and didnt have any of your mentioned problems. And I did use chef for bootstrapping a blank VM and doing functional tests with clients..
I also test the cookbooks with test-kitchen
I just checked and that VM has the same package versions installed. Also exact same CentOS version.
I didnt have to patch /usr/bin/spacewalk-setup-postgresql but also didnt see that isSUSE error. Would be worth a bugreport if its reproducable.
The pg_hba.conf already has that line for me.
So I’m not sure what to say to help you but it seems sth went wrong for you.
I guess if I were you, I’d do a manual install in a VM/instance, see if the problems happen. If that goes well, retry with cookbook.
Best, Phil
Hi Phil
I just made the test. I took a Clear new VM and execute manually the installation process.
I confirm still have the error isSUSE not found in /var/log/rhn/install_db.log
but this point and the pg_hba are not big issues I just told you that in case you planned to do a new release (apparently not – it does’t matter)
My main problem is that the installation don’t finish properly. I really don’t understand why !
Best
Olivier
Actually, after 1h waiting I have this message :
“Tomcat failed to start properly or the installer ran out of tries. Please check /var/log/tomcat*/catalina.out for errors”
=> whereas everything is fine in Tomcat Logs and all services are running correctly and the application is correctly reachable. I don’t see any error !