Puppet - 'unpack_tomcat' 处的语法错误;预期的 '}'
Puppet - Syntax error at 'unpack_tomcat'; expected '}'
我尝试将 tomcat 部署到 node1 代理
node default {
include lamp
}
node "node1.puppet" {
include tomcat
}
site.pp
├── auth.conf
├── fileserver.conf
├── manifests
│ └── site.pp
├── modules
│ ├── ftp
│ │ ├── files
│ │ │ └── vsftpd.conf
│ │ ├── lib
│ │ └── manifests
│ │ └── init.pp
│ ├── lamp
│ │ ├── lib
│ │ └── manifests
│ │ └── init.pp
│ ├── tomcat
│ │ ├── files
│ │ │ ├── apache-tomcat-8.0.17.zip
│ │ │ ├── script.sh
│ │ │ └── wgetrc
│ │ ├── lib
│ │ └── manifests
│ │ └── init.pp
│ └── unzip
│ └── manifests
│ └── init.pp
└── puppet.conf
我的文件结构..
以及/modules/tomcat/manifests/init.pp
的内容
class tomcat {
exec { "open_ports":
command => "/bin/firewall-cmd --zone=public --add-port=8080/tcp --permanent",
}
exec { "reload_firewall":
command => "/bin/firewall-cmd --reload",
require => Exec["open_ports"],
}
if $operatingsystem == "centos" {
file { "/etc/wgetrc":
owner => root,
group => root,
mode => 640,
source => "puppet:///modules/tomcat/wgetrc",
}
}
file { "/opt/apache-tomcat-8.0.17.zip":
owner => root,
group => root,
mode => 640,
source => "puppet:///modules/tomcat/apache-tomcat-8.0.17.zip,
}
exec { "unpack_tomcat":
command => "/usr/bin/unzip apache-tomcat-8.0.17,
cwd => "/opt",
require => File["/opt/apache-tomcat-8.0.17"],}
exec { "create_directorys":
command => "/bin/mkdir -p /opt/apache-tomcat-8.0.17/instances/original/{lib,work,temp,logs,webapps,bin},
require => Exec["create_directorys"],
}
}
我什么都试过了,我找不到错误..我做错了什么?
错误信息,从master拉目录后..
[root@node1 puppet]# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at 'unpack_tomcat'; expected '}' at /etc/puppet/modules/tomcat/manifests/init.pp:23 on node node1.puppet
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
提前致谢! :)
更新:
知道了!错误在 init.pp 文件中!
这是新的:
class tomcat {
exec { "open_ports":
command => "/bin/firewall-cmd --zone=public --add-port=8080/tcp --permanent",
}
exec { "reload_firewall":
command => "/bin/firewall-cmd --reload",
require => Exec["open_ports"],
}
if $operatingsystem == "centos" {
file { "/etc/wgetrc":
owner => root,
group => root,
mode => 640,
source => "puppet:///modules/tomcat/wgetrc",
}
}
file { "copy_tomcat":
owner => root,
group => root,
mode => 640,
path => "/opt/apache-tomcat-8.0.17.zip",
source => "puppet:///modules/tomcat/apache-tomcat-8.0.17.zip",
}
exec { "unpack_tomcat":
command => "/usr/bin/unzip apache-tomcat-8.0.17.zip",
cwd => "/opt",
require => File["copy_tomcat"],
}
exec { "create_directorys":
command => "/bin/mkdir -p /opt/apache-tomcat-8.0.17/instances/original/{lib,work,temp,logs,webapps,bin}",
require => Exec["unpack_tomcat"],
}
}
这一行漏了一个"
source => "puppet:///modules/tomcat/apache-tomcat-8.0.17.zip,
这些行也有同样的问题
command => "/usr/bin/unzip apache-tomcat-8.0.17,
command => "/bin/mkdir -p /opt/apache-tomcat-8.0.17/instances/original/{lib,work,temp,logs,webapps,bin},
我尝试将 tomcat 部署到 node1 代理
node default {
include lamp
}
node "node1.puppet" {
include tomcat
}
site.pp
├── auth.conf
├── fileserver.conf
├── manifests
│ └── site.pp
├── modules
│ ├── ftp
│ │ ├── files
│ │ │ └── vsftpd.conf
│ │ ├── lib
│ │ └── manifests
│ │ └── init.pp
│ ├── lamp
│ │ ├── lib
│ │ └── manifests
│ │ └── init.pp
│ ├── tomcat
│ │ ├── files
│ │ │ ├── apache-tomcat-8.0.17.zip
│ │ │ ├── script.sh
│ │ │ └── wgetrc
│ │ ├── lib
│ │ └── manifests
│ │ └── init.pp
│ └── unzip
│ └── manifests
│ └── init.pp
└── puppet.conf
我的文件结构..
以及/modules/tomcat/manifests/init.pp
的内容class tomcat {
exec { "open_ports":
command => "/bin/firewall-cmd --zone=public --add-port=8080/tcp --permanent",
}
exec { "reload_firewall":
command => "/bin/firewall-cmd --reload",
require => Exec["open_ports"],
}
if $operatingsystem == "centos" {
file { "/etc/wgetrc":
owner => root,
group => root,
mode => 640,
source => "puppet:///modules/tomcat/wgetrc",
}
}
file { "/opt/apache-tomcat-8.0.17.zip":
owner => root,
group => root,
mode => 640,
source => "puppet:///modules/tomcat/apache-tomcat-8.0.17.zip,
}
exec { "unpack_tomcat":
command => "/usr/bin/unzip apache-tomcat-8.0.17,
cwd => "/opt",
require => File["/opt/apache-tomcat-8.0.17"],}
exec { "create_directorys":
command => "/bin/mkdir -p /opt/apache-tomcat-8.0.17/instances/original/{lib,work,temp,logs,webapps,bin},
require => Exec["create_directorys"],
}
}
我什么都试过了,我找不到错误..我做错了什么?
错误信息,从master拉目录后..
[root@node1 puppet]# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at 'unpack_tomcat'; expected '}' at /etc/puppet/modules/tomcat/manifests/init.pp:23 on node node1.puppet
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
提前致谢! :)
更新:
知道了!错误在 init.pp 文件中!
这是新的:
class tomcat {
exec { "open_ports":
command => "/bin/firewall-cmd --zone=public --add-port=8080/tcp --permanent",
}
exec { "reload_firewall":
command => "/bin/firewall-cmd --reload",
require => Exec["open_ports"],
}
if $operatingsystem == "centos" {
file { "/etc/wgetrc":
owner => root,
group => root,
mode => 640,
source => "puppet:///modules/tomcat/wgetrc",
}
}
file { "copy_tomcat":
owner => root,
group => root,
mode => 640,
path => "/opt/apache-tomcat-8.0.17.zip",
source => "puppet:///modules/tomcat/apache-tomcat-8.0.17.zip",
}
exec { "unpack_tomcat":
command => "/usr/bin/unzip apache-tomcat-8.0.17.zip",
cwd => "/opt",
require => File["copy_tomcat"],
}
exec { "create_directorys":
command => "/bin/mkdir -p /opt/apache-tomcat-8.0.17/instances/original/{lib,work,temp,logs,webapps,bin}",
require => Exec["unpack_tomcat"],
}
}
这一行漏了一个"
source => "puppet:///modules/tomcat/apache-tomcat-8.0.17.zip,
这些行也有同样的问题
command => "/usr/bin/unzip apache-tomcat-8.0.17,
command => "/bin/mkdir -p /opt/apache-tomcat-8.0.17/instances/original/{lib,work,temp,logs,webapps,bin},