openstack-ansible-os_aodh/tasks/aodh_apache.yml

91 lines
2.5 KiB
YAML

---
# Copyright 2016, Comcast Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE(hwoarang) default openSUSE apache2 installation is missing
# some required modules so enable them here. This can possibly be
# extended to other distributions if necessary.
- name: Enable required apache2 modules (SUSE)
apache2_module:
name: "{{ item.name }}"
state: "{{ item.state }}"
with_items: "{{ aodh_apache_modules }}"
when:
- ansible_pkg_mgr == 'zypper'
- aodh_apache_modules is defined
notify:
- Restart web server
- name: Drop apache2 virtual host and ports file
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "root"
group: "root"
with_items: "{{ aodh_apache_config }}"
notify:
- Restart web server
- name: Disable default apache site
file:
path: "{{ item }}"
state: "absent"
with_items: "{{ aodh_apache_default_sites }}"
notify:
- Restart web server
- name: Enabled aodh vhost
file:
src: "{{ aodh_apache_site_available }}"
dest: "{{ aodh_apache_site_enabled }}"
state: "link"
when:
- aodh_apache_site_available is defined
- aodh_apache_site_enabled is defined
notify:
- Restart web server
- name: Ensure Apache ServerName
lineinfile:
dest: "{{ aodh_apache_conf }}"
line: "ServerName {{ inventory_hostname }}"
notify:
- Restart web server
- name: Ensure Apache ServerTokens
lineinfile:
dest: "{{ aodh_apache_security_conf }}"
regexp: '^ServerTokens'
line: "ServerTokens {{ aodh_apache_servertokens }}"
notify:
- Restart web server
- name: Ensure Apache ServerSignature
lineinfile:
dest: "{{ aodh_apache_security_conf }}"
regexp: '^ServerSignature'
line: "ServerSignature {{ aodh_apache_serversignature }}"
notify:
- Restart web server
- name: remove Listen from Apache config
lineinfile:
dest: "{{ aodh_apache_security_conf }}"
regexp: '^(Listen.*)'
backrefs: yes
line: '#\1'
notify:
- Restart web server