Reputation: 769
I'm trying to build Nginx from source through Ansible, but whenever the playbook reaches the ./configure
part it just hangs up indefinitely.
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 e.g raw: cd {{ nginx_build_dir }}/{{ nginx_version }} && ./configure ...
, but I get the same indefinite hang. I've tried waiting 20 minutes a couple of times and I'm sure it wouldn't take any longer than that.
EDIT: I've now managed to narrow the problem down to the --add-module
sections. e.g --add-module={{ nginx_pagespeed_build_dir }} --add-module={{ ngx_devel_build_dir }} --add-module={{ set_misc_build_dir }}
Module vars in vars folder:
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 }}/"
Upvotes: 0
Views: 203
Reputation: 769
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. I got around this by using the expect
module.
- 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
Upvotes: 1