Ansible没有安装Apache的重写模块。Ansible没有安装Apache重写模块
Ansible任务:
- name: Enable mod_rewrite
apache2_module:
state: present
name: rewrite
TAKS结果:
TASK [apache : Enable mod_rewrite] *********************************************
fatal: [local_vm]: FAILED! => {"changed": false, "failed": true, "msg": "Error executing /usr/sbin/apache2ctl: AH00526: Syntax error on line 33 of /etc/apache2/sites-enabled/mysite.conf:\nInvalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration\n"}
我注意到,该模块没有启用:
[email protected]:/etc/apache2/mods-enabled$ ls | grep write
[email protected]:/etc/apache2/mods-enabled$
更新#1
这里是mysite.conf的内容:
32: # Redirect to https
33: RewriteEngine On
34: RewriteCond %{REQUEST_URI} !^\/lightbox
mysite.conf的内容是什么?至少在犯罪线附近。 – tedder42
增加了更新1,指出问题出在哪里的第33行。 – TekiusFanatikus
那么问题是什么?似乎Apache抱怨模块不可用。它与Ansible有什么关系?是否启用它从CLI工作,但不是Ansible? – techraf