首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Ubuntu + Apache2.4 + mod_wsgi上为Ansible配置ARA?

如何在Ubuntu + Apache2.4 + mod_wsgi上为Ansible配置ARA?
EN

Stack Overflow用户
提问于 2018-03-12 13:47:29
回答 1查看 398关注 0票数 1

我正在尝试在Ubuntu16.04上安装ARA (https://github.com/openstack/ara)来监控我的Ansible playbook的执行。

我仔细阅读了文档(http://ara.readthedocs.io/en/latest/webserver.html#debian-ubuntu),但每次测试时都会被重定向到http://ara.home.lab/about

以下是我的配置文件:

Apache Vhost:

代码语言:javascript
复制
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>

可能的配置文件:

代码语言:javascript
复制
cat /var/www/ara/ansible.cfg
[defaults]
# This directory is required to store temporary files for Ansible and ARA
local_tmp = /var/www/ara/.ansible/tmp

[ara]
# This will default the database and logs location to be inside that directory.
dir = /var/www/ara/.ara

Vhost目录:

代码语言:javascript
复制
$ 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

到目前为止,我还不能从应用程序中找到任何告诉我错误的日志。

你能帮我个忙吗?

EN

回答 1

Stack Overflow用户

发布于 2018-03-13 11:01:49

你的配置看起来不错,但是你遗漏了告诉Ansible它需要加载ARA回调插件的地方,以及它的位置。

要找到ARA在哪里,您可以运行以下命令,无论您运行的是python2还是python3:

代码语言:javascript
复制
$ python -c "import os,ara; print(os.path.dirname(ara.__file__))"

如果ARA安装在虚拟环境中,那么在运行该命令之前,您需要获取并激活ARA。

如果它正常工作,它应该打印如下内容:

代码语言:javascript
复制
# The path for your ARA package might be different than this
/usr/local/lib/python2.7/dist-packages/ara

要启用ARA作为Ansible回调插件,请将此路径添加到ansible.cfg中的callback_plugins配置:

代码语言:javascript
复制
[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需要具有读写访问权限的数据库。这是留给读者的练习,因为它是关于文件系统权限的--一些用户已经创建了一个包含$USERwww-data的通用组。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49228837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档