3

I'm trying to setup a simple Puppet setup on AWS EC2 using the latest Amazon Linux AMI.

I've followed through the install guide for RHEL and have a puppetmasterd daemon running.

When apply the following manifest in /etc/puppet/manifests/site.pp:

node 'ip-172-31-1-239.eu-west-1.compute.internal' {
  class { 'apache': }
}

I get the error:

[ec2-user@ip-172-31-1-239 ~]$ sudo puppet agent --test
info: Loading facts in /etc/puppet/modules/concat/lib/facter/concat_basedir.rb
info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Class['apache::version']: Unsupported osfamily: Linux at /etc/puppet/modules/apache/manifests/version.pp:37 on node ip-172-31-1-239.eu-west-1.compute.internal
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

From version.pp of the Apache module for Puppet I can see why the manifest is failing to install Apache, but I can't understand why Facter is reporting the osfamily as "Linux" in the first place:

[ec2-user@ip-172-31-1-239 ~]$ facter | grep osfamily
osfamily => Linux

[ec2-user@ip-172-31-1-239 ~]$ rpm -qa | grep facter
facter-1.6.18-7.25.amzn1.noarch

[ec2-user@ip-172-31-1-239 ~]$ rpm -qa | grep puppet
puppetlabs-release-6-11.noarch
puppet-2.7.25-1.4.amzn1.noarch
puppet-server-2.7.25-1.4.amzn1.noarch

[ec2-user@ip-172-31-1-239 ~]$ sudo puppet module list
/etc/puppet/modules
├── puppetlabs-apache (v1.4.0)
├── puppetlabs-concat (v1.2.0)
└── puppetlabs-stdlib (v4.5.1)
/usr/share/puppet/modules (no modules installed)

Anyone any ideas how I can resolve this?

JoeNyland
  • 225
  • 1
  • 4
  • 12

3 Answers3

4

Don't use Amazon Linux. The Puppet Labs Apache module is not compatible with Amazon Linux. You will need to use one of the distributions which it is compatible with, or create your own Puppet module.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • This isn't really a solution is it? – JoeNyland Mar 22 '15 at 11:02
  • 2
    That is not entirely correct. `The module contains support for other distributions and operating systems, such as FreeBSD, Gentoo and Amazon Linux, but is not formally tested on those and regressions can occur.` ([source](https://github.com/puppetlabs/puppetlabs-apache/#general)). – faker Mar 22 '15 at 13:34
  • @MasterRoot24 After you get some experience with Amazon Linux and learn exactly what a steaming pile of trainwreck it is, you will wish you had switched. – Michael Hampton Mar 22 '15 at 15:21
  • 1
    @MichaelHampton Don't get me wrong: That was one of the first questions I asked when I started; "Why are you using Amazon Linux and not CentOS??" but this just gives me more ammunition to move our servers to CentOS :D – JoeNyland Mar 22 '15 at 16:34
3

After looking at it with a fresh pair of eyes today, I've found that Facter v1.7.0 includes a fix that classifies Amazon Linux as "RedHat" correctly: https://github.com/puppetlabs/facter/commit/c12d3b6c557df695a7b2b009da099f6a93c7bd31

Now I know why it's being incorrectly reported, I need to know why I'm not getting Facter v1.7.0 installed from the PuppetLabs Yum repo, which is out of scope of this question.

JoeNyland
  • 225
  • 1
  • 4
  • 12
1

The problem seems to be in the file /usr/lib/ruby/site_ruby/1.8/facter/osfamily.rb

which ends up using the osoperatingsystem as osfamily in the case of Amazon Linux.

Line 19 is:

 when "RedHat", "Fedora", "CentOS", "Scientific", "SLC", "Ascendos", "CloudLinux", "PSBM", "OracleLinux", "OVS", "OEL"

and should be:

 when "RedHat", "Fedora", "CentOS", "Scientific", "SLC", "Ascendos", "CloudLinux", "PSBM", "OracleLinux", "OVS", "OEL", "Amazon"
womble
  • 95,029
  • 29
  • 173
  • 228