tomcat - 将文本附加到 tomcat.conf 的末尾

标签 tomcat chef-infra

我正在使用 Opscode Tomcat 说明书以及我自己创建的说明书。我需要在/etc/default/tomcat{version} 文件的末尾附加一个循环,我已经研究过使用 partials 但我不确定如何通过我自己的 cookbook 应用它(我们公司的政策是创建我们自己的 Recipe ,将外部 Recipe 作为引用)。

我想也许 Template 资源可以做到这一点,但我也被告知 Providers 可能是解决方案。

最佳答案

您可以使用 Chef, Inc. 员工创建的 line Recipe 来处理较小的文件更改:

https://github.com/someara/line-cookbook

例子:

append_if_no_line "make sure a line is in dangerfile" do
  path "/tmp/dangerfile"
  line "HI THERE I AM STRING"
end

replace_or_add "spread the love" do
  path "/some/file"
  pattern "Why hello there.*"
  line "Why hello there, you beautiful person, you."
end

delete_lines "remove hash-comments from /some/file" do
  path "/some/file"
  pattern "^#.*"
end

add_to_list "add entry to a list"
  path "/some/file"
  pattern "People to call: "
  delim [","]
  entry "Bobby"
end

关于tomcat - 将文本附加到 tomcat.conf 的末尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30593380/

相关文章:

chef-infra - 如何正确配置berks以避免证书问题?

java - 使用 EnableAutoConfiguration 时如何更改默认端口 8080

Tomcat 不断覆盖 server.xml

java - 配置tomcat、hibernate和mysql

chef-infra - 如何在 Chef Recipe 中动态查找主机的 IP

mysql - 如何在 Chef Ruby block 中执行 MySQL

chef-infra - 允许 Chef 节点上传 Recipe

bash - 使用 Chef 运行 bash passwd

java - Tomcat autodeploy 不通过 HTTP 返回实际文件

java - .war 文件是否包含用于在容器中部署的所有依赖项 jar?