richardgirges
richardgirges

Reputation: 1532

import statements fail

I'm a Puppet newbie. I'm trying to setup a chef-style deployment environment. I have a puppet-master server set up, and I'd like to be able to configure/deploy to two nodes that I set up simultaneously.

What I'm expecting with my puppet setup right now is for my two servers (called img01 and img02) to automatically create a file called /tmp/test_file.txt.

I'm not even sure how to really "load in" a manifest. I just assumed that anything in site.pp would automatically get loaded, but that doesn't seem to be the case. When I run "puppet apply /etc/puppet/manifests/site.pp", I get the following:

Error: Could not parse for environment production: No file(s) found for import of 'test' at /etc/puppet/manifests/site.pp:3 on node puppet.lgwp.com
Error: Could not parse for environment production: No file(s) found for import of 'test' at /etc/puppet/manifests/site.pp:3 on node puppet.lgwp.com

This is what my manifest setup looks like right now:

Cert list on the puppet-master server:

+ "img01.lgwp.com.com"  (SHA256) (omitted)
+ "img02.lgwp.com"  (SHA256) (omitted)
+ "puppet.lgwp.com" (SHA256) (omitted) (alt names: "DNS:puppet.lgwp.com")

/etc/puppet/manifest/site.pp:

import "test" 

import "nodes"

Exec { path => "/usr/bin:/usr/sbin/:/bin:/sbin" }

/etc/puppet/manifest/nodes.pp:

import "test"

node "imageserver" {
  include "tempfile"
}

node 'img01.lgwp.com' inherits imageserver {
}
node 'img02.lgwp.com' inherits imageserver {
}

/etc/puppet/modules/test/manifests/test.pp:

class test {

  package { test: ensure => latest }

  file { "test_file":
    path => '/tmp/test_file.txt',
    ensure => present,
    mode => 0755,
    content => 'hola world',
    source => "puppet:///modules/test/test_file",
    require => Package["test"],
  }
}

Upvotes: 0

Views: 392

Answers (1)

Felix Frank
Felix Frank

Reputation: 8223

Don't use import. Just don't.

Remove the existing import statements and change the manifest setting in your puppet.conf to include all files in /etc/puppet/manifests.

[main]
manifest=/etc/puppet/manifests/

include tempfile makes no sense either, unless you have a tempfile module. Try

include test

Other classes in the test module should be named test::something and can also just be included. Puppet locates the manifests in the according modules. There is literally no need to use import anymore.

Upvotes: 1

Related Questions