Use systemd-journald instead of log files

This patch aims to migrate service from usage of regular syslog files
to journald.

Change-Id: Ic17eccceb6d23ca14b5d6d6eef516a670e3fb942
This commit is contained in:
Dmitriy Rabotyagov 2019-07-15 15:04:53 +03:00 committed by Dmitriy Rabotyagov (noonedeadpunk)
parent ca83b65ea2
commit 0d3c3c3961
4 changed files with 35 additions and 38 deletions

View File

@ -45,7 +45,9 @@ neutron_install_method: "source"
### Python code details
###
neutron_log_dir: "/var/log/neutron"
# Neutron logs are collected with systemd-journald by default
# neutron_log_dir may be used for complience with old ha-tool
#neutron_log_dir: "/var/log/neutron"
# Set the package install state for pip_package
# Options are 'present' and 'latest'
@ -121,9 +123,10 @@ neutron_dns_domain: "openstacklocal."
### DNSMasq configuration
###
# Dnsmasq doesn't work with config_template override, a deployer
# should instead configure its own neutron_dhcp_config key/values
neutron_dhcp_config:
log-facility: "{{ neutron_log_dir }}/neutron-dnsmasq.log"
# should instead configure its own neutron_dhcp_config key/values like this:
#neutron_dhcp_config:
# log-facility: "{{ neutron_log_dir }}/neutron-dnsmasq.log"
neutron_dhcp_config: {}
# Disable dnsmasq to resolve DNS via local resolv.conf.
# When dnsmasq_dns_servers are not set,

View File

@ -87,28 +87,23 @@
mode: "0755"
- path: "{{ neutron_system_home_folder }}/ha_confs"
- name: Test for log directory or link
shell: |
if [ -h "{{ neutron_log_dir }}" ]; then
chown -h {{ neutron_system_user_name }}:{{ neutron_system_group_name }} "{{ neutron_log_dir }}"
chown -R {{ neutron_system_user_name }}:{{ neutron_system_group_name }} "$(readlink {{ neutron_log_dir }})"
else
exit 1
fi
register: log_dir
failed_when: false
changed_when: log_dir.rc != 0
- name: Create neutron log dir
file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner|default(neutron_system_user_name) }}"
group: "{{ item.group|default(neutron_system_group_name) }}"
mode: "{{ item.mode|default('0755') }}"
with_items:
- { path: "{{ neutron_log_dir }}" }
when: log_dir.rc != 0
- name: Create log directory
block:
- name: Test for log directory
stat:
path: "{{ neutron_log_dir }}"
register: log_dir
- name: Create neutron log dir
file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner|default(neutron_system_user_name) }}"
group: "{{ item.group|default(neutron_system_group_name) }}"
mode: "{{ item.mode|default('0755') }}"
with_items:
- { path: "{{ neutron_log_dir }}" }
when: log_dir.stat.exists and file_details.stat.isdir
when: neutron_log_dir is defined
- name: Drop sudoers file
template:

View File

@ -13,7 +13,6 @@
use_stderr = False
debug = {{ debug }}
fatal_deprecations = {{ neutron_fatal_deprecations }}
log_file = {{ neutron_log_dir }}/neutron.log
use_journal = True
## Rpc all

View File

@ -341,7 +341,7 @@ neutron_services:
service_conf_path: "{{ neutron_conf_dir }}"
service_conf: dhcp_agent.ini
service_rootwrap: rootwrap.d/dhcp.filters
execstarts: "{{ neutron_bin }}/neutron-dhcp-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/dhcp_agent.ini --log-file={{ neutron_log_dir }}/neutron-dhcp-agent.log"
execstarts: "{{ neutron_bin }}/neutron-dhcp-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/dhcp_agent.ini"
config_overrides: "{{ neutron_dhcp_agent_ini_overrides }}"
config_type: "ini"
init_config_overrides: "{{ neutron_dhcp_agent_init_overrides }}"
@ -353,7 +353,7 @@ neutron_services:
service_conf_path: "{{ neutron_conf_dir }}"
service_conf: plugins/ml2/openvswitch_agent.ini
service_rootwrap: rootwrap.d/openvswitch-plugin.filters
execstarts: "{{ neutron_bin }}/neutron-openvswitch-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/plugins/ml2/ml2_conf.ini --config-file {{ neutron_conf_dir }}/plugins/ml2/openvswitch_agent.ini --log-file={{ neutron_log_dir }}/neutron-openvswitch-agent.log"
execstarts: "{{ neutron_bin }}/neutron-openvswitch-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/plugins/ml2/ml2_conf.ini --config-file {{ neutron_conf_dir }}/plugins/ml2/openvswitch_agent.ini"
config_overrides: "{{ neutron_openvswitch_agent_ini_overrides }}"
config_type: "ini"
init_config_overrides: "{{ neutron_openvswitch_agent_init_overrides }}"
@ -365,7 +365,7 @@ neutron_services:
service_conf_path: "{{ neutron_conf_dir }}"
service_conf: plugins/ml2/linuxbridge_agent.ini
service_rootwrap: rootwrap.d/linuxbridge-plugin.filters
execstarts: "{{ neutron_bin }}/neutron-linuxbridge-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/plugins/ml2/ml2_conf.ini --config-file {{ neutron_conf_dir }}/plugins/ml2/linuxbridge_agent.ini --log-file={{ neutron_log_dir }}/neutron-linuxbridge-agent.log"
execstarts: "{{ neutron_bin }}/neutron-linuxbridge-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/plugins/ml2/ml2_conf.ini --config-file {{ neutron_conf_dir }}/plugins/ml2/linuxbridge_agent.ini"
config_overrides: "{{ neutron_linuxbridge_agent_ini_overrides }}"
config_type: "ini"
init_config_overrides: "{{ neutron_linuxbridge_agent_init_overrides }}"
@ -376,7 +376,7 @@ neutron_services:
service_en: "{{ neutron_metadata | bool }}"
service_conf_path: "{{ neutron_conf_dir }}"
service_conf: metadata_agent.ini
execstarts: "{{ neutron_bin }}/neutron-metadata-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/metadata_agent.ini --log-file={{ neutron_log_dir }}/neutron-metadata-agent.log"
execstarts: "{{ neutron_bin }}/neutron-metadata-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/metadata_agent.ini"
config_overrides: "{{ neutron_metadata_agent_ini_overrides }}"
config_type: "ini"
init_config_overrides: "{{ neutron_metadata_agent_init_overrides }}"
@ -387,7 +387,7 @@ neutron_services:
service_en: "{{ neutron_metering | bool }}"
service_conf_path: "{{ neutron_conf_dir }}"
service_conf: metering_agent.ini
execstarts: "{{ neutron_bin }}/neutron-metering-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/metering_agent.ini --log-file={{ neutron_log_dir }}/neutron-metering-agent.log"
execstarts: "{{ neutron_bin }}/neutron-metering-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/metering_agent.ini"
config_overrides: "{{ neutron_metering_agent_ini_overrides }}"
config_type: "ini"
init_config_overrides: "{{ neutron_metering_agent_init_overrides }}"
@ -409,7 +409,7 @@ neutron_services:
service_rootwrap: rootwrap.d/l3.filters
environment:
PATH: "{{ neutron_bin }}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
execstarts: "{{ neutron_bin }}/neutron-l3-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/l3_agent.ini --log-file={{ neutron_log_dir }}/neutron-l3-agent.log"
execstarts: "{{ neutron_bin }}/neutron-l3-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/l3_agent.ini"
config_overrides: "{{ neutron_l3_agent_ini_overrides }}"
config_type: "ini"
init_config_overrides: "{{ neutron_l3_agent_init_overrides }}"
@ -420,7 +420,7 @@ neutron_services:
service_en: "{{ neutron_bgp | bool }}"
service_conf_path: "{{ neutron_conf_dir }}"
service_conf: bgp_dragent.ini
execstarts: "{{ neutron_bin }}/neutron-bgp-dragent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/bgp_dragent.ini --log-file={{ neutron_log_dir }}/neutron-bgp-dragent.log"
execstarts: "{{ neutron_bin }}/neutron-bgp-dragent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/bgp_dragent.ini"
config_overrides: "{{ neutron_bgp_dragent_ini_overrides }}"
config_type: "ini"
init_config_overrides: "{{ neutron_bgp_dragent_init_overrides }}"
@ -436,7 +436,7 @@ neutron_services:
service_conf_path: "{{ neutron_conf_dir }}"
service_conf: vpnaas_agent.ini
service_rootwrap: rootwrap.d/vpnaas.filters
execstarts: "{{ neutron_bin }}/neutron-vpn-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/vpnaas_agent.ini --log-file={{ neutron_log_dir }}/neutron-vpn-agent.log"
execstarts: "{{ neutron_bin }}/neutron-vpn-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/vpnaas_agent.ini"
config_overrides: "{{ neutron_vpnaas_agent_ini_overrides }}"
config_type: "ini"
init_config_overrides: "{{ neutron_vpn_agent_init_overrides }}"
@ -445,7 +445,7 @@ neutron_services:
group: neutron_server
service_name: neutron-server
service_en: True
execstarts: "{{ neutron_bin }}/neutron-server --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/{{ neutron_plugins[neutron_plugin_type].plugin_ini }} --log-file={{ neutron_log_dir }}/neutron-server.log"
execstarts: "{{ neutron_bin }}/neutron-server --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/{{ neutron_plugins[neutron_plugin_type].plugin_ini }}"
init_config_overrides: "{{ neutron_server_init_overrides }}"
start_order: 1
calico-felix:
@ -479,7 +479,7 @@ neutron_services:
service_en: "{{ 'ml2.sriov' in neutron_plugin_types }}"
service_conf_path: "{{ neutron_conf_dir }}"
service_conf: plugins/ml2/sriov_nic_agent.ini
execstarts: "{{ neutron_bin }}/neutron-sriov-nic-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/plugins/ml2/ml2_conf.ini --config-file {{ neutron_conf_dir }}/plugins/ml2/sriov_nic_agent.ini --log-file={{ neutron_log_dir }}/neutron-sriov-nic-agent.log"
execstarts: "{{ neutron_bin }}/neutron-sriov-nic-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/plugins/ml2/ml2_conf.ini --config-file {{ neutron_conf_dir }}/plugins/ml2/sriov_nic_agent.ini"
config_overrides: "{{ neutron_sriov_nic_agent_ini_overrides }}"
config_type: "ini"
init_config_overrides: "{{ neutron_sriov_nic_agent_init_overrides }}"
@ -499,7 +499,7 @@ neutron_services:
service_conf_path: "{{ neutron_conf_dir }}"
service_conf: networking_ovn_metadata_agent.ini
service_rootwrap: rootwrap.d/ovn-plugin.filters
execstarts: "{{ neutron_bin }}/networking-ovn-metadata-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/plugins/ml2/ml2_conf.ini --config-file {{ neutron_conf_dir }}/networking_ovn_metadata_agent.ini --log-file=/var/log/neutron/networking-ovn-metadata-agent.log"
execstarts: "{{ neutron_bin }}/networking-ovn-metadata-agent --config-file {{ neutron_conf_dir }}/neutron.conf --config-file {{ neutron_conf_dir }}/plugins/ml2/ml2_conf.ini --config-file {{ neutron_conf_dir }}/networking_ovn_metadata_agent.ini"
config_overrides: "{{ neutron_ovn_metadata_agent_ini_overrides }}"
config_type: "ini"
init_config_overrides: "{{ neutron_ovn_metadata_agent_init_overrides }}"