【发布时间】:2014-07-31 04:16:59
【问题描述】:
我正在创建一个 ansible 脚本来安装 ispconfig 而无需交互。我正在使用 expect 来处理 ispconfig 交互式安装 php 脚本。我正在使用 apt-get 版本的 expect 和最新版本的 ansible 将它安装在 Ubuntu 14.04 上。
运行期望脚本后 ansible 没有返回是怎么回事。
我使用的脚本如下:expect script on github
我从期望日志文件得到的输出是:
Stopping amavisd: amavisd-new.
Starting amavisd: amavisd-new.
* Stopping ClamAV daemon clamd
...done.
* Starting ClamAV daemon clamd
...done.
dovecot stop/waiting
dovecot start/running, process 30668
reload: Unknown instance:
* Reloading nginx configuration nginx
...done.
Installation completed.
string detected
当我在远程主机上运行脚本时,它运行完美。通过 ansible 执行此脚本,但它不会返回。在 ansible 等待时,使用 -v 运行 ansible 不会显示任何日志信息。
ansible脚本的相关部分是:
# as isconfig install is a interactive script we use expect to deal with that
# by checking if ispconfig is present we make this an idempotent process
# if ispconfig absent the install will run
- name: Check for installed ispconfig
command: /usr/bin/test ! -e "/usr/local/ispconfig"
register: ispconfig_absent
ignore_errors: true
- name: Copy expect script to configure ispconfig
template: src=ispconfig.exp dest=/root/ispconfig.exp
when: ispconfig_absent|success
- name: set perm for script to configure ispconfig
file: path=/root/ispconfig.exp mode=0750
when: ispconfig_absent|success
- name: configure ispconfig
command: "/root/ispconfig.exp"
when: ispconfig_absent|success
- name: remove ispconfig configure script
file: path=/root/ispconfig.exp state=absent
when: ispconfig_absent|success
执行 ps aux 表明期望脚本已失效。 ansible 进程等待进程返回。
有什么线索可以做什么吗?
【问题讨论】:
-
我遇到了确切的问题,您找到解决方案了吗?