Ansible 配置和制作

Ansible configure and make

配置和不工作作为单独的步骤。

- name: configure
  command: ./configure --with-python=/usr/local/bin/python2.7
  args:
    chdir: "/usr/src/mod_wsgi-{{ mod_wsgi_version }}"
- name: make
  command: make
  args:
    chdir: "/usr/src/mod_wsgi-{{ mod_wsgi_version }}"

但是,当我将它们组合在一个命令行中时,它们工作正常。

- name: configure and make
  command: ./configure --with-python=/usr/local/bin/python2.7; make
  args:
    chdir: "/usr/src/mod_wsgi-{{ mod_wsgi_version }}"

我的理解是 configure 正在构建一个 makefile,而不是在环境中做一些神奇的事情。我错了吗?

编辑: 我得到了一个线索,python 无法正确 运行,因为它需要一个环境变量:LD_LIBRARY_PATH.

我找到了根本原因。当我安装 python 时,我编辑了 /etc/profile 但这被 ansible 登录忽略了。因此 LD_LIBRARY_PATH 没有设置。我已经更新了 python 安装程序手册,将 shell 脚本添加到 /etc/profile.d/

我找到了根本原因。当我安装 python 时,我编辑了 /etc/profile 但这被 ansible 登录忽略了。因此 LD_LIBRARY_PATH 没有设置。我已经更新了 python 安装程序手册,将 shell 脚本添加到 /etc/profile.d/

令人惊讶的是,配置步骤没有出错,即使它未能正确 运行 python。可能是因为配置脚本没有返回非零值。