Browse Source

Install and start Rsyslog on the Undercloud & Standalone

Create a new Rsyslog service that is deployed on the host (not in a
container) and with Ansible.

Make it so it's deployed by default on Undercloud & Standalone setups.
Also move the tasks that configure rsyslogd for HAproxy & Swift to be
executed after the host prep tasks (using deploy step tasks).

Change-Id: I027c64aefcc4715da17836a5cf0141152cf146aa
Closes-Bug: #1850562
(cherry picked from commit 5ff628f1cf)
changes/12/692912/1
Emilien Macchi 2 years ago
parent
commit
42ba2c65ef
11 changed files with 174 additions and 90 deletions
  1. +25
    -22
      deployment/haproxy/haproxy-container-puppet.yaml
  2. +32
    -29
      deployment/haproxy/haproxy-pacemaker-puppet.yaml
  3. +57
    -0
      deployment/logging/rsyslog-baremetal-ansible.yaml
  4. +23
    -19
      deployment/swift/swift-proxy-container-puppet.yaml
  5. +24
    -20
      deployment/swift/swift-storage-container-puppet.yaml
  6. +1
    -0
      environments/standalone/standalone-tripleo.yaml
  7. +3
    -0
      environments/undercloud.yaml
  8. +5
    -0
      releasenotes/notes/rsyslog-5dc93db5eb8fc953.yaml
  9. +1
    -0
      roles/Undercloud.yaml
  10. +1
    -0
      roles_data_undercloud.yaml
  11. +2
    -0
      sample-env-generator/standalone.yaml

+ 25
- 22
deployment/haproxy/haproxy-container-puppet.yaml View File

@ -286,6 +286,31 @@ outputs:
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
deploy_steps_tasks:
- name: Configure rsyslog for HAproxy container
when: step|int == 1
block:
- name: Check if rsyslog exists
shell: systemctl is-active rsyslog
register: rsyslog_config
- when:
- rsyslog_config is changed
- rsyslog_config.rc == 0
block:
- name: Forward logging to haproxy.log file
blockinfile:
content: |
if $syslogfacility-text == '{{facility}}' and $programname == 'haproxy' then -/var/log/containers/haproxy/haproxy.log
& stop
create: yes
path: /etc/rsyslog.d/openstack-haproxy.conf
vars:
facility: {get_param: HAProxySyslogFacility}
register: logconfig
- name: restart rsyslog service after logging conf change
service:
name: rsyslog
state: restarted
when: logconfig is changed
- name: Run puppet on the host to apply IPtables rules
when: step|int == 1
shell: |
@ -340,28 +365,6 @@ outputs:
tripleo_delegate_to: "{{ groups['haproxy'] | default([]) }}"
host_prep_tasks:
- {get_attr: [HAProxyPublicTLS, role_data, host_prep_tasks]}
- name: Check if rsyslog exists
shell: systemctl is-active rsyslog
register: rsyslog_config
- when:
- rsyslog_config is changed
- rsyslog_config.rc == 0
block:
- name: Forward logging to haproxy.log file
blockinfile:
content: |
if $syslogfacility-text == '{{facility}}' and $programname == 'haproxy' then -/var/log/containers/haproxy/haproxy.log
& stop
create: yes
path: /etc/rsyslog.d/openstack-haproxy.conf
vars:
facility: {get_param: HAProxySyslogFacility}
register: logconfig
- name: restart rsyslog service after logging conf change
service:
name: rsyslog
state: restarted
when: logconfig is changed
- name: create persistent directories
file:
path: "{{ item.path }}"


+ 32
- 29
deployment/haproxy/haproxy-pacemaker-puppet.yaml View File

@ -290,28 +290,13 @@ outputs:
- {get_param: DeployIdentifier}
host_prep_tasks:
- {get_attr: [HAProxyBase, role_data, host_prep_tasks]}
- name: Check if rsyslog exists
shell: systemctl is-active rsyslog
register: rsyslog_config
- when:
- rsyslog_config is changed
- rsyslog_config.rc == 0
block:
- name: Forward logging to haproxy.log file
blockinfile:
content: |
if $syslogfacility-text == '{{facility}}' and $programname == 'haproxy' then -/var/log/containers/haproxy/haproxy.log
& stop
create: yes
path: /etc/rsyslog.d/openstack-haproxy.conf
vars:
facility: {get_param: HAProxySyslogFacility}
register: logconfig
- name: restart rsyslog service after logging conf change
service:
name: rsyslog
state: restarted
when: logconfig is changed
- name: haproxy logs readme
copy:
dest: /var/log/haproxy/readme.txt
content: |
Log files from the haproxy containers can be found under
/var/log/containers/haproxy.
ignore_errors: true
- name: create persistent directories
file:
path: "{{ item.path }}"
@ -321,16 +306,34 @@ outputs:
- { 'path': /var/log/containers/haproxy, 'setype': var_log_t }
- { 'path': /var/lib/haproxy, 'setype': svirt_sandbox_file_t }
- { 'path': /var/log/haproxy, 'setype': svirt_sandbox_file_t }
- name: haproxy logs readme
copy:
dest: /var/log/haproxy/readme.txt
content: |
Log files from the haproxy containers can be found under
/var/log/containers/haproxy.
ignore_errors: true
metadata_settings:
{get_attr: [HAProxyBase, role_data, metadata_settings]}
deploy_steps_tasks:
- name: Configure rsyslog for HAproxy container managed by Pacemaker
when: step|int == 1
block:
- name: Check if rsyslog exists
shell: systemctl is-active rsyslog
register: rsyslog_config
- when:
- rsyslog_config is changed
- rsyslog_config.rc == 0
block:
- name: Forward logging to haproxy.log file
blockinfile:
content: |
if $syslogfacility-text == '{{facility}}' and $programname == 'haproxy' then -/var/log/containers/haproxy/haproxy.log
& stop
create: yes
path: /etc/rsyslog.d/openstack-haproxy.conf
vars:
facility: {get_param: HAProxySyslogFacility}
register: logconfig
- name: restart rsyslog service after logging conf change
service:
name: rsyslog
state: restarted
when: logconfig is changed
- name: HAproxy tag container image for pacemaker
when: step|int == 1
import_role:


+ 57
- 0
deployment/logging/rsyslog-baremetal-ansible.yaml View File

@ -0,0 +1,57 @@
heat_template_version: rocky
description: >
Install and start rsyslog.
parameters:
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
DefaultPasswords:
default: {}
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
outputs:
role_data:
description: Role data for the TripleO rsyslog service.
value:
service_name: rsyslog_baremetal_ansible
config_settings: {}
deploy_steps_tasks: []
docker_config: {}
kolla_config: {}
puppet_config:
config_volume: ''
step_config: ''
config_image: ''
host_prep_tasks:
- name: Ensure rsyslog is installed
package:
name: rsyslog
state: installed
- name: Ensure rsyslog is enabled and started
systemd:
state: started
name: rsyslog
enabled: true

+ 23
- 19
deployment/swift/swift-proxy-container-puppet.yaml View File

@ -465,26 +465,30 @@ outputs:
- { 'path': /srv/node, 'setype': svirt_sandbox_file_t }
- { 'path': /var/log/swift, 'setype': svirt_sandbox_file_t }
- { 'path': /var/log/containers/swift, 'setype': svirt_sandbox_file_t }
- name: Check if rsyslog exists
shell: systemctl list-unit-files --type=service | grep -q rsyslog
register: rsyslog_config
failed_when: rsyslog_config.rc == 2
- block:
- name: Forward logging to swift.log file
copy:
content: |
# Fix for https://bugs.launchpad.net/tripleo/+bug/1776180
local2.* /var/log/containers/swift/swift.log
& stop
dest: /etc/rsyslog.d/openstack-swift.conf
register: logconfig
- name: Restart rsyslogd service after logging conf change
service: name=rsyslog state=restarted
deploy_steps_tasks:
- name: Configure rsyslog for swift-proxy
when: step|int == 1
block:
- name: Check if rsyslog exists
shell: systemctl list-unit-files --type=service | grep -q rsyslog
register: rsyslog_config
failed_when: rsyslog_config.rc == 2
- block:
- name: Forward logging to swift.log file
copy:
content: |
# Fix for https://bugs.launchpad.net/tripleo/+bug/1776180
local2.* /var/log/containers/swift/swift.log
& stop
dest: /etc/rsyslog.d/openstack-swift.conf
register: logconfig
- name: Restart rsyslogd service after logging conf change
service: name=rsyslog state=restarted
when:
- logconfig is changed
when:
- logconfig is changed
when:
- rsyslog_config is changed
- rsyslog_config.rc == 0
- rsyslog_config is changed
- rsyslog_config.rc == 0
update_tasks:
- name: Check swift containers log folder/symlink exists
stat:


+ 24
- 20
deployment/swift/swift-storage-container-puppet.yaml View File

@ -606,26 +606,6 @@ outputs:
Log files from swift containers can be found under
/var/log/containers/swift and /var/log/containers/httpd/swift-*.
ignore_errors: true
- name: Check if rsyslog exists
shell: systemctl list-unit-files --type=service | grep -q rsyslog
register: rsyslog_config
failed_when: rsyslog_config.rc == 2
- block:
- name: Forward logging to swift.log file
copy:
content: |
# Fix for https://bugs.launchpad.net/tripleo/+bug/1776180
local2.* /var/log/containers/swift/swift.log
& stop
dest: /etc/rsyslog.d/openstack-swift.conf
register: logconfig
- name: Restart rsyslogd service after logging conf change
service: name=rsyslog state=restarted
when:
- logconfig is changed
when:
- rsyslog_config is changed
- rsyslog_config.rc == 0
- name: Set fact for SwiftRawDisks
set_fact:
swift_raw_disks: {get_param: SwiftRawDisks}
@ -645,6 +625,30 @@ outputs:
state: mounted
with_items: "{{ swift_raw_disks }}"
when: swift_raw_disks
deploy_steps_tasks:
- name: Configure rsyslog for swift-storage
when: step|int == 1
block:
- name: Check if rsyslog exists
shell: systemctl list-unit-files --type=service | grep -q rsyslog
register: rsyslog_config
failed_when: rsyslog_config.rc == 2
- block:
- name: Forward logging to swift.log file
copy:
content: |
# Fix for https://bugs.launchpad.net/tripleo/+bug/1776180
local2.* /var/log/containers/swift/swift.log
& stop
dest: /etc/rsyslog.d/openstack-swift.conf
register: logconfig
- name: Restart rsyslogd service after logging conf change
service: name=rsyslog state=restarted
when:
- logconfig is changed
when:
- rsyslog_config is changed
- rsyslog_config.rc == 0
update_tasks:
- name: Ensure rsyncd pid file is absent
file:


+ 1
- 0
environments/standalone/standalone-tripleo.yaml View File

@ -115,6 +115,7 @@ resource_registry:
OS::TripleO::Services::PankoApi: OS::Heat::None
OS::TripleO::Services::Podman: ../../deployment/podman/podman-baremetal-ansible.yaml
OS::TripleO::Services::Redis: OS::Heat::None
OS::TripleO::Services::Rsyslog: ../../deployment/logging/rsyslog-baremetal-ansible.yaml
OS::TripleO::Services::SELinux: ../../deployment/selinux/selinux-baremetal-puppet.yaml
OS::TripleO::Services::SaharaApi: OS::Heat::None
OS::TripleO::Services::SaharaEngine: OS::Heat::None


+ 3
- 0
environments/undercloud.yaml View File

@ -58,6 +58,9 @@ resource_registry:
# This line will drop in Stein when it becomes the default.
OS::TripleO::Services::Podman: ../deployment/podman/podman-baremetal-ansible.yaml
# https://bugs.launchpad.net/tripleo/+bug/1850562
OS::TripleO::Services::Rsyslog: ../deployment/logging/rsyslog-baremetal-ansible.yaml
# Undercloud HA services
OS::TripleO::Services::HAproxy: OS::Heat::None
OS::TripleO::Services::Keepalived: OS::Heat::None


+ 5
- 0
releasenotes/notes/rsyslog-5dc93db5eb8fc953.yaml View File

@ -0,0 +1,5 @@
---
features:
- |
On undercloud and standalone, install rsyslog on the host by default.
See https://bugs.launchpad.net/tripleo/+bug/1850562

+ 1
- 0
roles/Undercloud.yaml View File

@ -81,6 +81,7 @@
- OS::TripleO::Services::Podman
- OS::TripleO::Services::Redis
- OS::TripleO::Services::Rhsm
- OS::TripleO::Services::Rsyslog
- OS::TripleO::Services::SELinux
- OS::TripleO::Services::Sshd
- OS::TripleO::Services::SwiftProxy


+ 1
- 0
roles_data_undercloud.yaml View File

@ -84,6 +84,7 @@
- OS::TripleO::Services::Podman
- OS::TripleO::Services::Redis
- OS::TripleO::Services::Rhsm
- OS::TripleO::Services::Rsyslog
- OS::TripleO::Services::SELinux
- OS::TripleO::Services::Sshd
- OS::TripleO::Services::SwiftProxy


+ 2
- 0
sample-env-generator/standalone.yaml View File

@ -141,6 +141,8 @@ environments:
OS::TripleO::Services::PankoApi: OS::Heat::None
# Redis
OS::TripleO::Services::Redis: OS::Heat::None
# Rsyslog
OS::TripleO::Services::Rsyslog: ../../deployment/logging/rsyslog-baremetal-ansible.yaml
# Sahara
OS::TripleO::Services::SaharaApi: OS::Heat::None
OS::TripleO::Services::SaharaEngine: OS::Heat::None


Loading…
Cancel
Save