New for Foreman, trying 1.4 install all in one, problems with smart class parameters

Hi,

I am following the screencasts to install foreman and a test NTP module
(saz/ntp). I do already have a production puppet deployed using hiera. I
wanted to test Foreman and smart class parameters (ntp server_list). I
have Foreman 1.4 installed on a new CentOS 6.5 vm with mysql backend and
puppet 3.4.2 from puppetlabs.

I have an issue getting Override Value for Specific Hosts working. I am
trying to replicate my current hiera setup. Match fqdn works all the time.
Match on domain works with domain=testdomain.com and not
domain="testdomain.com". I'm not sure how the quotes are causing the
problem. I have also tried matching facts, operatingsystem=CentOS and
operatingsystem="CentOS" and neither appear to work even though the fact
for the host exists. Fact osfamily works again only if I use
osfamily=RedHat and not osfamily="RedHat".

I wanted to understand how Smart Class Parameters worked before I explored
Foreman further and start using custom facts.

Thanks,
Toan

Quotes aren't necessary at all.

Regarding "operatingsystem", this is an odd one. Matchers work in one
of two ways:

  1. they match Foreman attributes of a host
  2. they match fact names

An example of the former would be "hostgroup" which matches the
name/label of the host's host group. "operatingsystem" is unfortunately
both an attribute of the host in Foreman and the name of a fact, but
Foreman will prefer its attributes over fact names.

This means that operatingsystem needs to match Foreman's OS names, which
unfortunately include the version number - so "operatingsystem=CentOS
6.5" should match.

Somebody came across this in IRC the other day, but I can't find an
associated redmine #, you may wish to file one.

If you really need the OS fact itself, you could perhaps add a custom
fact referring to Facter.value(:operatingsystem) and use that instead in
the matcher, but it's a bit hacky.

··· On 07/02/14 22:25, Toan Ngo wrote: > Hi, > > I am following the screencasts to install foreman and a test NTP module > (saz/ntp). I do already have a production puppet deployed using hiera. > I wanted to test Foreman and smart class parameters (ntp server_list). > I have Foreman 1.4 installed on a new CentOS 6.5 vm with mysql backend > and puppet 3.4.2 from puppetlabs. > > I have an issue getting Override Value for Specific Hosts working. I am > trying to replicate my current hiera setup. Match fqdn works all the > time. Match on domain works with domain=testdomain.com and not > domain="testdomain.com". I'm not sure how the quotes are causing the > problem. I have also tried matching facts, operatingsystem=CentOS and > operatingsystem="CentOS" and neither appear to work even though the fact > for the host exists. Fact osfamily works again only if I use > osfamily=RedHat and not osfamily="RedHat". > > I wanted to understand how Smart Class Parameters worked before I > explored Foreman further and start using custom facts.


Dominic Cleal
Red Hat Engineering

operatingsystem=CentOS 6.5 does work. I am testing using lsbdistid for
operating system since I only was the operatingsystem name and not the
version. Is "location" also a Foreman attribute? I have a custom fact in
my current production deployment to identify the location (city) of the
server. I guess I should ask where to find a list of built in Foreman
attribute names.

Toan

··· On Friday, February 7, 2014 2:25:09 PM UTC-8, Toan Ngo wrote: > > Hi, > > I am following the screencasts to install foreman and a test NTP module > (saz/ntp). I do already have a production puppet deployed using hiera. I > wanted to test Foreman and smart class parameters (ntp server_list). I > have Foreman 1.4 installed on a new CentOS 6.5 vm with mysql backend and > puppet 3.4.2 from puppetlabs. > > I have an issue getting Override Value for Specific Hosts working. I am > trying to replicate my current hiera setup. Match fqdn works all the time. > Match on domain works with domain=testdomain.com and not domain=" > testdomain.com". I'm not sure how the quotes are causing the problem. I > have also tried matching facts, operatingsystem=CentOS and > operatingsystem="CentOS" and neither appear to work even though the fact > for the host exists. Fact osfamily works again only if I use > osfamily=RedHat and not osfamily="RedHat". > > I wanted to understand how Smart Class Parameters worked before I explored > Foreman further and start using custom facts. > > Thanks, > Toan >

Yes, "location" is an attribute if you have Foreman's locations features
enabled in settings.yaml.

There's not a definitive list, but this API example is fairly comprehensive:
http://theforeman.org/api/apidoc/v2/hosts/show.html

··· On 11/02/14 16:59, Toan Ngo wrote: > operatingsystem=CentOS 6.5 does work. I am testing using lsbdistid for > operating system since I only was the operatingsystem name and not the > version. Is "location" also a Foreman attribute? I have a custom fact > in my current production deployment to identify the location (city) of > the server. I guess I should ask where to find a list of built in > Foreman attribute names.


Dominic Cleal
Red Hat Engineering