nginx - 运行 Nginx ./configure 时,Ansible playbook 挂起
问题描述
我正在尝试通过 Ansible 从源代码构建 Nginx,但是每当剧本到达该./configure
部分时,它就会无限期地挂起。
这是命令:
- 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
我也尝试过使用 shell 模块和原始模块运行相同的命令,例如raw: cd {{ nginx_build_dir }}/{{ nginx_version }} && ./configure ...
,但我得到相同的无限期挂起。我试过几次等待 20 分钟,我相信它不会比这更久。
编辑:我现在已经设法将问题缩小到各个--add-module
部分。例如--add-module={{ nginx_pagespeed_build_dir }} --add-module={{ ngx_devel_build_dir }} --add-module={{ set_misc_build_dir }}
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 }}/"
解决方案
我设法弄清楚了这一点,所以我会回答我自己的问题。该问题是由于当您将--with-debug
其作为./configure
参数时出现的提示引起的。我通过使用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
推荐阅读
- c# - 当前上下文中不存在名称“表”
- iis - 我如何无法通过 ejabberd 配置域,替换 localhost:5280/admin?
- linux - u-boot 在软重启时挂起
- angular - 在 Angular 库中使用带有 Ng-Packagr 的全局变量
- craftcms - Craft 3 CMS 不能在生产环境中运行“Craft 需要 PHP 7.0 或更高版本。”
- php - 想尝试一些循环的标签
- python - 如何将 NULL 视为带有 pandas 的普通字符串?
- html - Bootstrap Columns 垂直堆叠
- javascript - 谷歌地图 - 透明线切断标记
- python-3.x - Python中的指数曲线拟合