如何在Ubuntu+;Apache2.4+;mod_wsgi?
我正试图在Ubuntu 16.04上安装ARA(),以监控Ansible playbook的执行情况 我仔细阅读文档(),但每次测试时都会被重定向到 以下是我的配置文件: Apache Vhost:如何在Ubuntu+;Apache2.4+;mod_wsgi?,ubuntu,ansible,mod-wsgi,wsgi,apache2.4,Ubuntu,Ansible,Mod Wsgi,Wsgi,Apache2.4,我正试图在Ubuntu 16.04上安装ARA(),以监控Ansible playbook的执行情况 我仔细阅读文档(),但每次测试时都会被重定向到 以下是我的配置文件: Apache Vhost: cat /etc/apache2/sites-available/ara.conf <VirtualHost *:80> # Replace ServerName by your hostname ServerName ara.home.lab ErrorLog
cat /etc/apache2/sites-available/ara.conf
<VirtualHost *:80>
# Replace ServerName by your hostname
ServerName ara.home.lab
ErrorLog /var/log/apache2/ara-error.log
LogLevel warn
CustomLog /var/log/apache2/ara-access.log combined
WSGIDaemonProcess ara user=www-data group=www-data processes=4 threads=1
WSGIScriptAlias / /var/www/ara/ara-wsgi
SetEnv ANSIBLE_CONFIG /var/www/ara/ansible.cfg
<Directory /var/www/ara>
WSGIProcessGroup ara
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
</VirtualHost>
Vhost目录:
$ pwd
/var/www/ara
$ ls -la
total 24
drwxr-xr-x 4 www-data www-data 4096 Mar 12 00:15 .
drwxr-xr-x 7 root root 4096 Mar 11 23:59 ..
drwxrwx--- 3 www-data www-data 4096 Oct 27 17:00 .ansible
-rw-r--r-- 1 www-data www-data 234 Oct 27 16:57 ansible.cfg
drwx------ 2 www-data www-data 4096 Mar 12 00:15 .ara
-rwxr-xr-x 1 www-data www-data 1804 Mar 11 01:08 ara-wsgi
到目前为止,我无法从应用程序中找到任何告诉我错误的日志
你能帮我一下吗?你的配置看起来不错,但是你没有告诉Ansible它需要加载ARA回调插件以及它的位置 要查找ARA所在的位置,您可以运行以下命令,无论您运行的是python2还是python3:
$ python -c "import os,ara; print(os.path.dirname(ara.__file__))"
如果在虚拟环境中安装了ARA,则需要在运行该命令之前对其进行源代码获取和激活
如果有效,它应该打印如下内容:
# The path for your ARA package might be different than this
/usr/local/lib/python2.7/dist-packages/ara
要将ARA启用为Ansible回调插件,请将此路径添加到Ansible.cfg中的回调插件配置:
[defaults]
# This directory is required to store temporary files for Ansible and ARA
local_tmp = /var/www/ara/.ansible/tmp
callback_plugins = /usr/local/lib/python2.7/dist-packages/ara/plugins/callbacks
[ara]
# This will default the database and logs location to be inside that directory.
dir = /var/www/ara/.ara
您可以通过查看/var/www/ara/.ara
目录来判断这是否有效——您将在应用程序自行引导时自动创建一个ansible.sqlite
文件
这是您的用户和Apache需要对其进行读写访问的数据库。这是留给读者的练习,因为它是关于文件系统权限的——一些用户创建了一个包含$USER
和www-data
的公共组
[defaults]
# This directory is required to store temporary files for Ansible and ARA
local_tmp = /var/www/ara/.ansible/tmp
callback_plugins = /usr/local/lib/python2.7/dist-packages/ara/plugins/callbacks
[ara]
# This will default the database and logs location to be inside that directory.
dir = /var/www/ara/.ara