Ansible playbook在运行Nginx时挂起。/configure

Ansible playbook在运行Nginx时挂起。/configure,nginx,ansible,Nginx,Ansible,我试图通过Ansible从源代码构建Nginx,但每当playbook到达/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

我试图通过Ansible从源代码构建Nginx,但每当playbook到达
/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模块运行相同的命令,例如
raw:cd{{{nginx\u build\u dir}/{{nginx\u version}&&./configure…
,但我得到了相同的无限挂起。我已经试着等了20分钟好几次了,我肯定不会再等了

编辑:我现在已经设法将问题缩小到
--addmodule
部分。e、 g
--add module={{nginx\u pagespeed\u build\u dir}}--add module={{ngx\u devel\u build\u dir}}--add module={{set\u misc\u build\u dir}

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 }}/"

我设法弄明白了,所以我要回答我自己的问题。 该问题是由于将调试作为
/configure
参数时出现提示而导致的。我通过使用
expect
模块解决了这个问题


-名称:使用自定义模块配置NGINX源
期望:
命令:“./配置…”
响应:
“使用可用的发行版二进制文件\”\[Y/n\]':“Y”
chdir:{{nginx_build_dir}}/{{{nginx_version}
回声:是的
当:nginx\u pagespeed\u module\u unpack更改或nginx\u psol\u unpack更改或nginx\u source\u unpack更改时
寄存器:nginx\u配置
-调试:var=nginx\u配置