Add CentOS support for os_gnocchi role

Depends-on: Id31fb15b352a160c8f5139ae70966055d93f7ce6
Change-Id: I540e8f08f3a8935b6a5af5a73f0a896ec8ec7a98
This commit is contained in:
Marc Gariepy 2016-12-05 11:51:38 -05:00 committed by Marc Gariépy
parent 1904d317d7
commit 259cf1e634
7 changed files with 118 additions and 13 deletions

View File

@ -36,7 +36,7 @@
- name: Restart Apache
service:
name: "apache2"
name: "{{ gnocchi_system_service_name }}"
state: "restarted"
pattern: "apache2"
when: gnocchi_use_mod_wsgi | bool

View File

@ -0,0 +1,3 @@
---
features:
- CentOS7/RHEL support has been added to the os_gnocchi role.

View File

@ -20,39 +20,39 @@
dest: "{{ item.dest }}"
owner: "root"
group: "root"
with_items:
- { src: "gnocchi-ports.conf.j2", dest: "/etc/apache2/ports.conf" }
- { src: "gnocchi-httpd.conf.j2", dest: "/etc/apache2/sites-available/gnocchi-httpd.conf" }
with_items: "{{ gnocchi_apache_config }}"
notify:
- Restart Apache
- name: Disable default apache site
file:
path: "/etc/apache2/sites-enabled/000-default.conf"
path: "{{ item }}"
state: "absent"
with_items: "{{ gnocchi_apache_default_sites }}"
notify:
- Restart Apache
- name: Enabled gnocchi vhost
file:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
state: "{{ item.state }}"
with_items:
- { src: "/etc/apache2/sites-available/gnocchi-httpd.conf", dest: "/etc/apache2/sites-enabled/gnocchi-httpd.conf", state: "link" }
src: "{{ gnocchi_apache_site_available }}"
dest: "{{ gnocchi_apache_site_enabled }}"
state: "link"
when:
- gnocchi_apache_site_available is defined
- gnocchi_apache_site_enabled is defined
notify:
- Restart Apache
- name: Ensure Apache ServerName
lineinfile:
dest: "/etc/apache2/apache2.conf"
dest: "{{ gnocchi_apache_conf }}"
line: "ServerName {{ inventory_hostname }}"
notify:
- Restart Apache
- name: Ensure Apache ServerTokens
lineinfile:
dest: "/etc/apache2/conf-available/security.conf"
dest: "{{ gnocchi_apache_security_conf }}"
regexp: '^ServerTokens'
line: "ServerTokens {{ gnocchi_apache_servertokens }}"
notify:
@ -60,15 +60,33 @@
- name: Ensure Apache ServerSignature
lineinfile:
dest: "/etc/apache2/conf-available/security.conf"
dest: "{{ gnocchi_apache_security_conf }}"
regexp: '^ServerSignature'
line: "ServerSignature {{ gnocchi_apache_serversignature }}"
notify:
- Restart Apache
- name: remove Listen from Apache config
lineinfile:
dest: "{{ gnocchi_apache_security_conf }}"
regexp: '^(Listen.*)'
backrefs: yes
line: '#\1'
notify:
- Restart Apache
- name: Enable/disable mod_ssl for apache2
apache2_module:
name: ssl
state: "{{ gnocchi_ssl | bool | ternary('present', 'absent') }}"
when:
- ansible_pkg_mgr == 'apt'
notify:
- Restart Apache
- name: Load service
service:
name: "{{ gnocchi_system_service_name }}"
enabled: "yes"
state: "started"

View File

@ -18,6 +18,11 @@
when:
- ansible_pkg_mgr == 'apt'
- include: gnocchi_install_yum.yml
static: no
when:
- ansible_pkg_mgr == 'yum'
- name: Create developer mode constraint file
copy:
dest: "/opt/developer-pip-constraints.txt"

View File

@ -0,0 +1,24 @@
---
# Copyright 2015, Rackspace US, Inc.
#
# 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.
- name: Install yum packages
yum:
pkg: "{{ item }}"
state: "{{ gnocchi_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ gnocchi_distro_packages }}"

39
vars/redhat-7.yml Normal file
View File

@ -0,0 +1,39 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# 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.
#: Necessary packages
gnocchi_distro_packages:
- '@Development Tools'
- httpd
- httpd-tools
- mod_wsgi
- git
- python-devel
- libpqxx-devel
gnocchi_system_service_name: httpd
gnocchi_apache_config:
- { src: "gnocchi-ports.conf.j2", dest: "/etc/httpd/conf.d/ports.conf" }
- { src: "gnocchi-httpd.conf.j2", dest: "/etc/httpd/conf.d/gnocchi-httpd.conf" }
gnocchi_apache_default_sites:
- "/etc/httpd/conf.d/userdir.conf"
- "/etc/httpd/conf.d/welcome.conf"
- "/etc/httpd/conf.d/ssl.conf"
gnocchi_apache_conf: "/etc/httpd/conf/httpd.conf"
gnocchi_apache_security_conf: "{{ gnocchi_apache_conf }}"

View File

@ -22,3 +22,19 @@ gnocchi_distro_packages:
- build-essential
- python-dev
- libpq-dev
gnocchi_system_service_name: apache2
gnocchi_apache_config:
- { src: "gnocchi-ports.conf.j2", dest: "/etc/apache2/ports.conf" }
- { src: "gnocchi-httpd.conf.j2", dest: "/etc/apache2/sites-available/gnocchi-httpd.conf" }
gnocchi_apache_default_sites:
- "/etc/apache2/sites-enabled/000-default.conf"
gnocchi_apache_site_available: "/etc/apache2/sites-available/gnocchi-httpd.conf"
gnocchi_apache_site_enabled: "/etc/apache2/sites-enabled/gnocchi-httpd.conf"
gnocchi_apache_conf: "/etc/apache2/apache2.conf"
gnocchi_apache_security_conf: "/etc/apache2/conf-available/security.conf"