简体   繁体   English

运行Nginx时Ansible剧本挂起./configure

[英]Ansible playbook hangs when running Nginx ./configure

I'm trying to build Nginx from source through Ansible, but whenever the playbook reaches the ./configure part it just hangs up indefinitely. 我正在尝试通过Ansible从源代码构建Nginx,但是只要剧本到达./configure部分,它就会无限期地挂起。

Here's the command: 这是命令:

- name: Configuring NGINX source with custom modules
command: "./configure --with-select_module --with-poll_module --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module=dynamic --with-stream_ssl_preread_module --with-google_perftools_module --with-compat --with-pcre=../pcre-8.42 --with-pcre-jit --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.1.1a --with-openssl-opt=no-nextprotoneg --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,--as-needed' --with-debug --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --build=CentOS --builddir=nginx-1.15.7 --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --add-module={{ nginx_pagespeed_build_dir }} --add-module={{ ngx_devel_build_dir }} --add-module={{ set_misc_build_dir }}"
  args:
    chdir: "{{ nginx_build_dir }}/{{ nginx_version }}"
register: nginx_configure
- debug: var=nginx_configure

I've also tried running the same command using the shell module and the raw module eg raw: cd {{ nginx_build_dir }}/{{ nginx_version }} && ./configure ... , but I get the same indefinite hang. 我也尝试过使用shell模块和原始模块运行相同的命令,例如raw: cd {{ nginx_build_dir }}/{{ nginx_version }} && ./configure ... ,但是我得到了相同的不确定的挂起。 I've tried waiting 20 minutes a couple of times and I'm sure it wouldn't take any longer than that. 我已经尝试了等待20分钟几次,而且我敢肯定它不会花更长的时间。

EDIT: I've now managed to narrow the problem down to the --add-module sections. 编辑:我现在设法将问题缩小到--add-module部分。 eg --add-module={{ nginx_pagespeed_build_dir }} --add-module={{ ngx_devel_build_dir }} --add-module={{ set_misc_build_dir }} 例如--add-module={{ nginx_pagespeed_build_dir }} --add-module={{ ngx_devel_build_dir }} --add-module={{ set_misc_build_dir }}

Module vars in vars folder: vars文件夹中的模块vars:

nginx_build_dir: /home/ansible/nginx
ngx_devel_build_dir: "{{ nginx_build_dir }}/ngx_devel_kit-0.3.1rc1"
set_misc_build_dir: "{{ nginx_build_dir }}/set-misc-nginx-module-0.32"
nginx_pagespeed_version: 1.13.35.2
nginx_pagespeed_version_label: stable
nginx_pagespeed_build_dir: "{{ nginx_build_dir }}/incubator-pagespeedngx-{{ nginx_pagespeed_version }}-{{ nginx_pagespeed_version_label }}/"

I managed to figure this out, so I'll answer my own question. 我设法弄清楚了,所以我会回答我自己的问题。 The problem was caused due to a prompt which occurs when you have --with-debug as a ./configure parameter. 该问题是由于将--with-debug作为./configure参数时出现提示而引起的。 I got around this by using the expect module. 我通过使用expect模块解决了这个问题。

- name: Configuring NGINX source with custom modules expect: command: "./configure ...." responses: 'Use the available Release binaries\\? \\[Y/n\\]': 'y' chdir: "{{ nginx_build_dir }}/{{ nginx_version }}" echo: yes when: nginx_pagespeed_module_unpack is changed or nginx_psol_unpack is changed or nginx_source_unpack is changed register: nginx_configure - debug: var=nginx_configure

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM