导入语句失败

理查德·吉尔吉斯

我是木偶新手。我正在尝试设置厨师风格的部署环境。我已经设置了一个人偶主服务器,并且希望能够配置/部署到同时设置的两个节点。

我现在期望的人偶设置是让我的两个服务器(分别称为img01和img02)自动创建一个名为/tmp/test_file.txt的文件。

我什至不确定如何真正“加载”清单。我只是假设site.pp中的任何内容都会自动加载,但事实并非如此。当我运行“ puppet apply /etc/puppet/manifests/site.pp”时,得到以下信息:

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

这是我的清单设置现在的样子:

人偶主服务器上的证书列表:

+ "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"],
  }
}
费利克斯·弗兰克(Felix Frank)

不要使用导入。只是不要。

删除现有import语句,然后更改中的manifest设置以将puppet.conf中的所有文件包括在内/etc/puppet/manifests

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

include tempfile除非您有一个tempfile模块,否则也没有任何意义尝试

include test

test模块中的其他类应该被命名test::something并且也可以被包括在内。木偶在相应的模块中找到清单。字面上没有必要再使用import了。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章