From 7b29f145e8bc355f7b8c6ae40686b952a6811db5 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 25 Apr 2017 10:07:55 +0100 Subject: [PATCH] Allow log directories to be configured In some cases it is useful to be able to configure the directory into which log files are written by bifrost services. Of particular note is the kolla-ansible project which typically stores log files in a docker volume mapped to /var/log/kolla/ inside containers. Currently the bifrost_deploy container is unable to persist its logs for this reason. This change enables configuration of the log directory path for the following services: - ironic-api - ironic-conductor - ironic-inspector - nginx Change-Id: I452052fa2f9a55fac2f00b454a5ac70464c9d981 Closes-Bug: #1685871 --- playbooks/roles/bifrost-ironic-install/README.md | 9 +++++++++ .../roles/bifrost-ironic-install/defaults/main.yml | 9 +++++++++ .../templates/ironic-inspector.conf.j2 | 4 ++++ .../bifrost-ironic-install/templates/ironic.conf.j2 | 4 ++++ .../bifrost-ironic-install/templates/nginx.conf.j2 | 4 ++-- .../notes/log-directories-87b86df40464bb2d.yaml | 11 +++++++++++ 6 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/log-directories-87b86df40464bb2d.yaml diff --git a/playbooks/roles/bifrost-ironic-install/README.md b/playbooks/roles/bifrost-ironic-install/README.md index 8c05fbe0f..b339a9e6c 100644 --- a/playbooks/roles/bifrost-ironic-install/README.md +++ b/playbooks/roles/bifrost-ironic-install/README.md @@ -155,6 +155,15 @@ remote_syslog_server: String value, default undefined. If set, rsyslog is remote_syslog_port: String value, default is 514. If set, custom port is configured for remote syslog server. +ironic_log_dir: String value, default undefined. If set, it specifies a + a non-default log directory for ironic. + +inspector_log_dir: String value, default undefined. If set, it specifies a + non-default log directory for inspector. + +nginx_log_dir: String value, default /var/log/nginx. It specifies a log + directory for nginx. + ### Hardware Inspection Support Bifrost also supports the installation of ironic-inspector in standalone diff --git a/playbooks/roles/bifrost-ironic-install/defaults/main.yml b/playbooks/roles/bifrost-ironic-install/defaults/main.yml index 8a29affe4..77f74de49 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/main.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/main.yml @@ -133,6 +133,15 @@ inspector_manage_firewall: false # Deprecated: ironic_auth_strategy will be removed in Pike. ironic_auth_strategy: "noauth" +# Set ironic_log_dir to use a non-default log directory for ironic. +#ironic_log_dir: + +# Set inspector_log_dir to use a non-default log directory for inspector. +#inspector_log_dir: + +# Set nginx_log_dir to use a non-default log directory for nginx. +nginx_log_dir: /var/log/nginx + inspector_data_dir: "/opt/stack/ironic-inspector/var" inspector_store_ramdisk_logs: true # Note: inspector_port_addition has three valid values: all, active, pxe diff --git a/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 b/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 index fb3f6db1f..76efc4cf9 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 @@ -11,6 +11,10 @@ auth_strategy = {{ inspector_auth | default('noauth') }} {% endif %} debug = {{ inspector_debug | bool }} +{% if inspector_log_dir is defined %} +log_dir = {{ inspector_log_dir }} +{% endif %} + [database] connection=mysql+pymysql://inspector:{{ ironic_db_password }}@localhost/inspector?charset=utf8 diff --git a/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 b/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 index d7e947dd6..25aefbf76 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 @@ -26,6 +26,10 @@ auth_strategy = keystone auth_strategy = noauth {% endif %} +{% if ironic_log_dir is defined %} +log_dir = {{ ironic_log_dir }} +{% endif %} + [pxe] pxe_append_params = systemd.journald.forward_to_console=yes {{ extra_kernel_options | default('') }} pxe_config_template = $pybasedir/drivers/modules/ipxe_config.template diff --git a/playbooks/roles/bifrost-ironic-install/templates/nginx.conf.j2 b/playbooks/roles/bifrost-ironic-install/templates/nginx.conf.j2 index 1ecd22ff6..4dbae51f2 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/nginx.conf.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/nginx.conf.j2 @@ -30,8 +30,8 @@ http { # Logging Settings ## - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; + access_log {{ nginx_log_dir }}/access.log; + error_log {{ nginx_log_dir }}/error.log; ## # Gzip Settings diff --git a/releasenotes/notes/log-directories-87b86df40464bb2d.yaml b/releasenotes/notes/log-directories-87b86df40464bb2d.yaml new file mode 100644 index 000000000..7d0b25083 --- /dev/null +++ b/releasenotes/notes/log-directories-87b86df40464bb2d.yaml @@ -0,0 +1,11 @@ +--- +features: + - | + Allows log directories to be configured + + In some cases it is useful to be able to configure the directory into which + log files are written by bifrost services. + + It is now possible to configure the ironic, inspector and nginx log + directories using the ``ironic_log_dir``, ``inspector_log_dir``, and + ``nginx_log_dir`` variables respectively.