用于子接口的puppet网络模块

时间:2014-01-16 20:41:27

标签: linux interface puppet

我是木偶新手,我刚刚安装了razorsedge/network的网络模块,但我不知道在哪里放ipaddressnetmask信息等。

这就是我做的事情

[root@puppetmaster manifests]# ls -l /etc/puppet/modules/network/manifests
total 32
drwxr-xr-x 2 puppet puppet 4096 Jan 16 14:50 alias
-r--r--r-- 1 puppet puppet 1420 Jan 16 15:31 alias.pp
drwxr-xr-x 2 puppet puppet 4096 Jan 16 14:50 bond
drwxr-xr-x 2 puppet puppet 4096 Jan 16 14:50 bridge
-r--r--r-- 1 puppet puppet 2363 Aug 18 20:57 global.pp
drwxr-xr-x 2 puppet puppet 4096 Jan 16 14:50 if
-r--r--r-- 1 puppet puppet 3564 Aug 18 20:57 init.pp
-r--r--r-- 1 puppet puppet 1423 Aug 18 20:57 route.pp

我有编辑文件alias.pp并将以下信息放在文件的末尾。

# define network::alias

network::alias { 'eth0:0':
        ensure    => 'up',
        ipaddress => '10.3.68.98',
        netmask   => '255.255.224.0'
}

我的node.pp

node client01 {
        include ntp
        include network::alias
}

当我在客户端上运行木偶时,我遇到了错误Could not find class network::alias ???

[root@client01 ~]# puppet agent --test --noop
Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class network::alias for client01 on node client01
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

我做错了什么?

1 个答案:

答案 0 :(得分:1)

  

我有编辑文件alias.pp并将以下信息放在文件的末尾。

您不编辑alias.pp文件来创建接口。您在节点定义中创建network :: alias资源:

node client01 {
  include ntp
  network::alias { 'eth0:0':
    ensure    => 'up',
    ipaddress => '10.3.68.98',
    netmask   => '255.255.224.0'
  }
}

network :: alias是一个已定义的资源,允许您创建它的多个实例。它不是一个可以包含的类。