我已经生成了一个新模板,我将用它来编辑Nginx配置文件。 nginx.conf.erb文件是在我的cookbook的Templates文件夹中创建的,我已编辑它以使其按我的意愿配置Nginx。 在我的食谱中,我添加了以下内容,使用我的nginx.conf.erb模板更新我的Nginx配置文件:
template '/etc/nginx/conf.d/default.conf' do
source 'nginx.conf.erb'
user 'root'
group 'root'
mode '0644'
end
问题是当我运行'kitchen converge'并登录到vagrant实例时,我的Nginx conf文件(/etc/nginx/conf.d/default.conf)没有更新到我的nginx.conf的内容.erb文件。在收敛期间没有错误,并且看起来配方中的其他所有内容都已运行。 ChefDK不会让我在输出中滚动得足够远,看看发生了什么。关于为什么模板可能没有更新或者我在哪里可以找到能够从汇聚中获得完整输出的日志的任何建议?
Chef客户端输出(下面)引用我想要对Nginx conf文件进行的更新,但是当我在收敛后登录时文件没有更新。
I, [2016-12-21T16:33:22.524333 #6764] INFO -- default-centos-67: * template[/etc/nginx/conf.d/default.conf] action create
I, [2016-12-21T16:33:22.524333 #6764] INFO -- default-centos-67: - update content in file /etc/nginx/conf.d/default.conf from 2c3f71 to 348c91
I, [2016-12-21T16:33:22.524833 #6764] INFO -- default-centos-67: --- /etc/nginx/conf.d/default.conf 2016-10-31 12:37:31.000000000 +0000
I, [2016-12-21T16:33:22.524833 #6764] INFO -- default-centos-67: +++ /etc/nginx/conf.d/.chef-default20161221-2093-4qbcg9.conf 2016-12-21 21:33:21.094000001 +0000
I, [2016-12-21T16:33:22.524833 #6764] INFO -- default-centos-67: @@ -1,27 +1,52 @@
I, [2016-12-21T16:33:22.524833 #6764] INFO -- default-centos-67: #
I, [2016-12-21T16:33:22.525333 #6764] INFO -- default-centos-67: -# The default server
I, [2016-12-21T16:33:22.525333 #6764] INFO -- default-centos-67: +# The default WebCanada nginx front-end server
I, [2016-12-21T16:33:22.525333 #6764] INFO -- default-centos-67: #
I, [2016-12-21T16:33:22.525333 #6764] INFO -- default-centos-67:
I, [2016-12-21T16:33:22.525333 #6764] INFO -- default-centos-67: +
I, [2016-12-21T16:33:22.525333 #6764] INFO -- default-centos-67: server {
I, [2016-12-21T16:33:22.525333 #6764] INFO -- default-centos-67: - listen 80 default_server;
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: - listen [::]:80 default_server;
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: - server_name _;
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: - root /usr/share/nginx/html;
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: + listen 80;
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: + server_name spgcravings.com www.spgcravings.com origin-www.spgcravings.com;
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67:
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: - # Load configuration files for the default server block.
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: - include /etc/nginx/default.d/*.conf;
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: + root '/var/www/vhosts/spg_cravings/httpdocs';
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67:
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: + location ~* \.php$ {
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: + proxy_pass http://127.0.0.1:8000;
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: + proxy_set_header Host $host;
I, [2016-12-21T16:33:22.525833 #6764] INFO -- default-centos-67: + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
I, [2016-12-21T16:33:22.526333 #6764] INFO -- default-centos-67: + }
I, [2016-12-21T16:33:22.526333 #6764] INFO -- default-centos-67: +
I, [2016-12-21T16:33:22.531333 #6764] INFO -- default-centos-67: + location /assets/ {
I, [2016-12-21T16:33:22.531333 #6764] INFO -- default-centos-67: + gzip_static on;
I, [2016-12-21T16:33:22.531333 #6764] INFO -- default-centos-67: + }
I, [2016-12-21T16:33:22.531333 #6764] INFO -- default-centos-67: +
I, [2016-12-21T16:33:22.531333 #6764] INFO -- default-centos-67: location / {
I, [2016-12-21T16:33:22.531333 #6764] INFO -- default-centos-67: + proxy_pass http://127.0.0.1:8000;
I, [2016-12-21T16:33:22.531333 #6764] INFO -- default-centos-67: + proxy_set_header Host $host;
I, [2016-12-21T16:33:22.531333 #6764] INFO -- default-centos-67: + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
I, [2016-12-21T16:33:22.531333 #6764] INFO -- default-centos-67: }
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: +}
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67:
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: - error_page 404 /404.html;
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: - location = /40x.html {
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: +
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: +server {
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: + listen 80;
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: + server_name ihlgt.com www.ihlgt.com origin-www.ihlgt.com;
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: +
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: + root '/var/www/vhosts/ihlgt/httpdocs';
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: +
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: + location ~* \.php$ {
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: + proxy_pass http://127.0.0.1:8000;
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: + proxy_set_header Host $host;
I, [2016-12-21T16:33:22.531833 #6764] INFO -- default-centos-67: + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67: }
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67:
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67: - error_page 500 502 503 504 /50x.html;
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67: - location = /50x.html {
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67: + location /assets/ {
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67: + gzip_static on;
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67: }
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67:
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67: + location / {
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67: + proxy_pass http://127.0.0.1:8000;
I, [2016-12-21T16:33:22.532333 #6764] INFO -- default-centos-67: + proxy_set_header Host $host;
I, [2016-12-21T16:33:22.536833 #6764] INFO -- default-centos-67: + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
I, [2016-12-21T16:33:22.536833 #6764] INFO -- default-centos-67: + }
I, [2016-12-21T16:33:22.536833 #6764] INFO -- default-centos-67: }
答案 0 :(得分:1)
完整日志位于.kitchen/logs/$instancename.log
。这将向您展示chef-client的输出。您还可以仔细检查是否将模板文件放在正确的位置(尽管如果您没有这样做可能会出错):templates/nginx.conf.erb
(或templates/default/nginx.conf.erb
如果您仍在使用过时的default/
子文件夹)。