有没有办法让Ansible在控制节点上本地运行构建脚本,然后将生成的工件部署到各个托管节点?
如果我遗漏了什么,请告诉我,但我查看了shell
,command
和script
模块的文档,它们似乎都只允许在托管节点上执行。我真的很惊讶我找不到在控制节点上运行命令的方法。
也许这不在 Ansible 的驾驶室里?您是否应该使用其他一些工具Make
来进行构建,然后 Ansible 只处理将其复制到服务器的想法?
我尝试在 Centos7 上用 nginx 编译 ldap 模块。然而,我遇到了大量的编译错误。
我来到这里的前几个:
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/libxml2 -I objs -I src/http -I src/http/modules -I src/http/v2 \
-o objs/src/http/modules/ngx_http_stub_status_module.o \
src/http/modules/ngx_http_stub_status_module.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/libxml2 -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/mail -I src/stream \
-o objs/addon/ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.o \
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c:6:1: error: expected identifier or ‘(’ before ‘<’ token
<!DOCTYPE html>
^
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c:31:3: error: stray ‘\302’ in program
<title>nginx-auth-ldap/ngx_http_auth_ldap_module.c at master · kvspb/nginx-auth-ldap · GitHub</title>
^
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c:31:3: error: stray ‘\267’ in program
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c:31:3: error: stray ‘\302’ in program
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c:31:3: error: stray ‘\267’ in program
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c:148:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
</a>
^
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c:174:267: error: expected identifier or ‘(’ before ‘<’ token
<a href="/features" class="py-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Features">Features <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a>
^
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c:187:332: error: expected identifier or ‘(’ before ‘<’ token
<li class="edge-item-fix"><a href="/customer-stories" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Customer stories">Customer stories <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a></li>
^
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c:188:308: error: expected identifier or ‘(’ before ‘<’ token
<li class="edge-item-fix"><a href="/security" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Security">Security <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a></li>
^
./ngx_http_auth_ldap_module/ngx_http_auth_ldap_module.c:211:299: error: expected identifier or ‘(’ before ‘<’ token
<li class="edge-item-fix"><a href="/explore" class="py-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Explore">Explore GitHub <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a></li>
我尝试使用 nginx 1.19 编译并从github获取最新版本 。
在制作之前我做了:
nginx 1.19 源码下载解压 nginx-ldap-auth 模块源码下载解压
yum install gcc zlib-devel openssl-devel make pcre-devel libxml2-devel libxslt-devel libgcrypt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel
和
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --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 --user=nginx --group=nginx --with-http_ssl_module --with-http_sub_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_secure_link_module --add-module=./nginx-auth-ldap-master --with-http_auth_request_module --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
我错过了什么?我很久以前做过同样的练习,结果很好。只是太久无法记住,那一刻的来源早已不复存在。
我在一个“有点自定义”的 Centos 6/cPanel 服务器上从源代码编译 PHP 时遇到了问题。一般来说它过去可以工作,现在不行。在此框中编译了许多不同的 PHP,并且没有更大的问题。现在,任何版本的 PHP 都停留在:
'Generating phar.phar'.
一些输出:
Prerequisite `/root/php-7.0.13/ext/phar/phar/phar.inc' is older than target `ext/phar/phar/phar.inc'.
No need to remake target `ext/phar/phar/phar.inc'.
Pruning file `/root/php-7.0.13/ext/phar/phar/clicommand.inc'.
Pruning file `/root/php-7.0.13/ext/phar/phar/directorygraphiterator.inc'.
Pruning file `/root/php-7.0.13/ext/phar/phar/directorytreeiterator.inc'.
Pruning file `/root/php-7.0.13/ext/phar/phar/invertedregexiterator.inc'.
Pruning file `/root/php-7.0.13/ext/phar/phar/pharcommand.inc'.
Pruning file `/root/php-7.0.13/ext/phar/phar/phar.inc'.
Pruning file `/root/php-7.0.13/ext/phar/phar/phar.php'.
Pruning file `sapi/cli/php'.
Finished prerequisites of target file ext/phar/phar.phar'.
Must remake target ext/phar/phar.phar'.
Putting child 0x022ef310 (ext/phar/phar.phar) PID 22348 on the chain.
Live child 0x022ef310 (ext/phar/phar.phar) PID 22348
Generating phar.phar
Reaping winning child 0x022ef310 PID 22348
Live child 0x022ef310 (ext/phar/phar.phar) PID 22349
Reaping winning child 0x022ef310 PID 22349
Live child 0x022ef310 (ext/phar/phar.phar) PID 22350
Reaping winning child 0x022ef310 PID 22350
Live child 0x022ef310 (ext/phar/phar.phar) PID 22351
我试过make'ing,只有1个线程,但没有帮助。
在“干净”之后:
Considering target file `/root/php-7.0.13/ext/phar/phar/phar.inc'.
File `/root/php-7.0.13/ext/phar/phar/phar.inc' was considered already.
Considering target file `/root/php-7.0.13/ext/phar/phar/phar.php'.
File `/root/php-7.0.13/ext/phar/phar/phar.php' was considered already.
Considering target file `sapi/cli/php'.
File `sapi/cli/php' was considered already.
Finished prerequisites of target file `ext/phar/phar.phar'.
Must remake target `ext/phar/phar.phar'.
Need a job token; we don't have children
Putting child 0x00d53610 (ext/phar/phar.phar) PID 17444 on the chain.
Commands of `ext/phar/phar.phar' are being run.
Finished prerequisites of target file `pharcmd'.
The prerequisites of `pharcmd' are being made.
Finished prerequisites of target file `all'.
The prerequisites of `all' are being made.
Live child 0x00d53610 (ext/phar/phar.phar) PID 17444
Generating phar.phar
Reaping winning child 0x00d53610 PID 17444
Live child 0x00d53610 (ext/phar/phar.phar) PID 17445
Reaping winning child 0x00d53610 PID 17445
Live child 0x00d53610 (ext/phar/phar.phar) PID 17446
Reaping winning child 0x00d53610 PID 17446
Live child 0x00d53610 (ext/phar/phar.phar) PID 17447
我尝试使用 make-4.2 而不是默认的 make-3.81,但它没有任何改变。
一些 strace 输出:
stat("/root/php-7.0.13/ext/phar/phar/phar.php", {st_mode=S_IFREG|0755,,st_size=992, ...}) = 0
stat("ext/phar/phar.phar", 0x7ffc5f1a4930) = -1 ENOENT (No such file or directory)
stat("ext/phar/phar/phar.inc", {st_mode=S_IFREG|0644, st_size=790, ...}) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16875
rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT TERM XCPU XFSZ], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
stat("/root/php-7.0.13/ext/json/json_scanner.c", {st_mode=S_IFREG|0644, st_size=29634, ...}) = 0
rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT TERM XCPU XFSZ], NULL, 8) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
vfork() = 16877
fcntl(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fcntl(3, F_SETFD, 0) = 0
fcntl(4, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fcntl(4, F_SETFD, 0) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
wait4(-1, Generating phar.phar
[{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16877
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16877, si_status=0, si_utime=0, si_stime=0} ---
rt_sigreturn() = 16877
rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT TERM XCPU XFSZ], NULL, 8) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
vfork() = 16878
fcntl(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fcntl(3, F_SETFD, 0) = 0
fcntl(4, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fcntl(4, F_SETFD, 0) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16878
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16878,si_status=0, si_utime=0, si_stime=0} ---
rt_sigreturn() = 16878
rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT TERM XCPU XFSZ], NULL, 8) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
vfork() = 16879
fcntl(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fcntl(3, F_SETFD, 0) = 0
fcntl(4, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fcntl(4, F_SETFD, 0) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16879
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16879, si_status=0, si_utime=0, si_stime=0} ---
rt_sigreturn() = 16879
rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT TERM XCPU XFSZ], NULL, 8) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
vfork() = 16880
fcntl(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fcntl(3, F_SETFD, 0) = 0
fcntl(4, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fcntl(4, F_SETFD, 0) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
wait4(-1,