Use a nginx conf.d file for the custom logging
To cater for the situation where there are no containers, or nginx is shared in some way, it's better to add custom directives for nginx.conf into a conf.d file. That way it's never overwritten. To resolve the situation where repo_server overwrites the config laid down by os_keystone, we implement the custom log in this way. The task which verifies that the right config directories exist is modified to ensure that both the sites and the conf.d directories exist before this configuration is laid down. For CentOS/OpenSUSE they are the same directory, but for Ubuntu they are different. This patch also ensurs that the previous implementation is removed, otherwise an upgrade fails. This patch should be back portable to ensure that zero-container deploys for Queens work properly. Change-Id: I2ab0f591c1cdeae43a002d9c8cf9bbfdd69597f1
This commit is contained in:
parent
4d92214d6b
commit
bbd70d5f9b
@ -27,21 +27,38 @@
|
||||
- Manage LB
|
||||
- Restart web server
|
||||
|
||||
- name: Configure custom nginx log format
|
||||
- name: Ensure configuration directories exist
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "/etc/nginx/{{ keystone_nginx_conf_path }}"
|
||||
- "/etc/nginx/conf.d"
|
||||
|
||||
# TODO(odyssey4me):
|
||||
# This is to cater for P->Q, Q-R upgrades and can be removed in S
|
||||
- name: Remove previously implemented custom nginx log format
|
||||
lineinfile:
|
||||
# NOTE(hwoarang) Not every nginx.conf file is the same
|
||||
# so it's best if we just append new stuff after known starting blocks.
|
||||
insertafter: http {
|
||||
dest: "/etc/nginx/nginx.conf"
|
||||
line: "log_format custom '{{ keystone_nginx_access_log_format_combined }} {{ keystone_nginx_access_log_format_extras }}';"
|
||||
state: absent
|
||||
notify:
|
||||
- Manage LB
|
||||
- Restart web server
|
||||
|
||||
- name: Ensure configuration directory exists
|
||||
file:
|
||||
path: "/etc/nginx/{{ keystone_nginx_conf_path }}"
|
||||
state: directory
|
||||
- name: Configure custom nginx log format
|
||||
copy:
|
||||
# NOTE(odyssey4me):
|
||||
# To cater for the situation where there are no containers, or
|
||||
# nginx is shared in some way, it's better to add custom directives
|
||||
# for nginx.conf into a conf.d file. That way it's never overwritten.
|
||||
content: |
|
||||
# Ansible managed
|
||||
log_format custom '{{ keystone_nginx_access_log_format_combined }} {{ keystone_nginx_access_log_format_extras }}';
|
||||
dest: "/etc/nginx/conf.d/custom_log.conf"
|
||||
notify:
|
||||
- Manage LB
|
||||
- Restart web server
|
||||
|
||||
# Configure app
|
||||
- name: Configure virtual hosts
|
||||
|
Loading…
Reference in New Issue
Block a user