Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)
Problem:
I have been using Foreman/Katello for a couple months now, so far have managed to do unattended provisioning of VMs using Libvirt and use some puppet modules for custom configs on all the puppet agents.
I am now wanting to streamline a bit more and advance my use of Puppet with the following:
*Have the puppet agent install during provisioning and have the new node subscribe to katello
*Configure basic sysadmin tasks such as create a local user during provisioning, map smb shares (fstab entries) etc.
I currently have a script I have to run on each new machine to do the above but really want to learn how to do all this during provisioning.
Is the only way to do this by editing the templates? Are there any tutorials on doing this? I have been searching for a couple days and had no luck finding anything relevant to what I want to achieve.
Good to be a part of this community, thanks in advance.
It should install puppet automatically if you set the the puppet master. Note that it’ll then install puppet but if you set enable-puppetlabs-puppet5-repo to true as a global parameter it will also set up puppet 5 repositories (at least for kickstarts and preseeds). This is how it’s done in the kickstart:
Those are in the git repository that actually stores our templates and get into releases so if you have any changes, that’s the place to submit patches
So I have managed to get puppet agent to install during KVM provisioning however puppet agent version 3.6 gets installed. Once logging in and running a status command on the puppet service I get the following:
Nov 06 19:34:45 t4. puppet-agent[2797]: Could not set ‘file’ on ensure: incorrect header check Nov 06 19:34:45 t4. puppet-agent[2797]: Wrapped exception: Nov 06 19:34:45 t4 puppet-agent[2797]: incorrect header check Nov 06 19:34:45 t4. puppet-agent[2797]: (/File[/var/lib/puppet/lib/puppet/parser/functions/parsejson…heck Nov 06 19:34:45 t4. puppet-agent[2797]: Could not set ‘file’ on ensure: incorrect header check Nov 06 19:34:45 t4. puppet-agent[2797]: Could not set ‘file’ on ensure: incorrect header check Nov 06 19:34:45 t4 puppet-agent[2797]: Wrapped exception: Nov 06 19:34:45 t4 puppet-agent[2797]: incorrect header check Nov 06 19:34:45 t4. puppet-agent[2797]: (/File[/var/lib/puppet/lib/puppet/parser/functions/validate_c…heck Nov 06 19:34:50 t4. puppet-agent[2797]: Finished catalog run in 0.07 seconds Hint: Some lines were ellipsized, use -l to show in full.
All puppet reports in Katello have the same errors.
The weird thing is, when the machine was provisioned, all puppet classes had been pulled from the master and installed on the agent without issue.
I have done a puppet upgrade to version 4.10.12 and all errors go away with service status as below:
There are enable-puppetlabs-puppet4-repo and enable-puppetlabs-puppet5-repo global parameters that should enable the right repositories. See Foreman :: Manual on how to set them.
If that doens’t work, we’ll need to know which versions you’re using. That of Foreman but also the OS and OS version you’re trying to provision.
I am having no luck with enabling puppet 4 repo.
I have Foreman 1.19 and Katello 3.8 installed on my system. So the provisioning templates have the required code to enable to correct repos I would of thought. I have done the following (see screen shot) in global parameters, unsure if it is correct or not. However it made no difference and puppet 3.6 is still getting installed. NOTE: I also tried value ‘true’ instead of ‘enable’.
Also, I am not sure if I should have a local mirror of the repository to allow this? Or do you let the new host install from the puppet repos?
The 3 puppet repos are false by default. Choose the repo you want to enable for the puppet agents to download from (for me it was enable-puppetlabs-pc1-repo)
Then goto Global Parameter, create a new parameter and name it as per the template (eg. enable-puppetlabs-pc1-repo). Then in value enter true
New machine now provisions with puppet-agent 4.10.
This solution helped me as well, but I would like to know why you need the parameter set. I cloned the kickstart file, hard coded pc1-repo to true, then attached it to my OS. I provisioned a machine and it had puppet 3.6.1 on it. I then added a parameter to my OS, restaged the machine, and now it has puppet 4.10 on it. Why does editing the template not change what happens during provisioning? If I edit any of the things in the provisioning template, would a parameter need to be set?
The solution I posted above allowed me to provision new VMs with puppet 4. Check over everything and make sure the OS is using that template, also add the global parameter.
You may have got confused with what is required. You do not need to clone the kickstart file, you do not need to modify it. Simply create the global parameter. See screen shot below.
I did get it to work, I was wondering why just editing the Kickstart provisioning template is not enough. I would think that if it is set to true in the template, provisioning would see true, and work accordingly.