厨师:'kitchen converge' 没有采购新模板
Chef: 'kitchen converge' not sourcing new template
我生成了一个新模板,我将使用它来编辑 Nginx conf 文件。
nginx.conf.erb 文件是在我的 cookbook 的 Templates 文件夹中创建的,我对其进行了编辑以使其按照我的意愿配置 Nginx。
在我的食谱中,我添加了以下内容以使用我的 nginx.conf.erb 模板更新我的 Nginx conf 文件:
template '/etc/nginx/conf.d/default.conf' do
source 'nginx.conf.erb'
user 'root'
group 'root'
mode '0644'
end
问题是当我 运行 a 'kitchen converge' 并登录到 vag运行t 实例时,我的 Nginx 配置文件 (/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: }
完整日志在 .kitchen/logs/$instancename.log
中。这将向您显示 chef-client 的输出。您还可以仔细检查您是否将模板文件放在正确的位置(尽管如果您不这样做可能会出错):templates/nginx.conf.erb
(或者 templates/default/nginx.conf.erb
如果您仍在使用过时的 default/
子文件夹).
我生成了一个新模板,我将使用它来编辑 Nginx conf 文件。 nginx.conf.erb 文件是在我的 cookbook 的 Templates 文件夹中创建的,我对其进行了编辑以使其按照我的意愿配置 Nginx。 在我的食谱中,我添加了以下内容以使用我的 nginx.conf.erb 模板更新我的 Nginx conf 文件:
template '/etc/nginx/conf.d/default.conf' do
source 'nginx.conf.erb'
user 'root'
group 'root'
mode '0644'
end
问题是当我 运行 a 'kitchen converge' 并登录到 vag运行t 实例时,我的 Nginx 配置文件 (/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: }
完整日志在 .kitchen/logs/$instancename.log
中。这将向您显示 chef-client 的输出。您还可以仔细检查您是否将模板文件放在正确的位置(尽管如果您不这样做可能会出错):templates/nginx.conf.erb
(或者 templates/default/nginx.conf.erb
如果您仍在使用过时的 default/
子文件夹).