
This patch enables persistent systemd journals and allows a deployer to disable the option if needed. The disk space requirements are extremely low since the files are stored in binary format. It is significantly less storage than rsyslog requires. Closes-Bug: 1748195 Change-Id: I4de267f2839c5022e83a07fa7779f242808df5c0
109 lines
3.5 KiB
YAML
109 lines
3.5 KiB
YAML
---
|
|
# Copyright 2017, 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: Check Kernel Version
|
|
fail:
|
|
msg: >
|
|
Wrong kernel Version found
|
|
[ {{ ansible_kernel }} < {{ openstack_host_required_kernel }} ]
|
|
Resolve this issue before continuing.
|
|
when: ansible_kernel | version_compare(openstack_host_required_kernel, '<')
|
|
|
|
- name: Disable cache for apt update for hosts
|
|
copy:
|
|
content: |
|
|
Acquire::http::No-Cache true;
|
|
dest: "/etc/apt/apt.conf.d/00apt-no-cache"
|
|
tags:
|
|
openstack_hosts-config
|
|
when:
|
|
- ansible_pkg_mgr == 'apt'
|
|
- >
|
|
global_environment_variables.http_proxy is defined or
|
|
global_environment_variables.HTTP_PROXY is defined or
|
|
global_environment_variables.https_proxy is defined or
|
|
global_environment_variables.HTTPS_PROXY is defined
|
|
|
|
- name: Install distro packages for bare metal nodes
|
|
package:
|
|
name: "{{ openstack_host_metal_distro_packages }}"
|
|
state: "{{ openstack_hosts_package_state }}"
|
|
register: install_packages
|
|
until: install_packages | success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: check how kernel modules are implemented (statically builtin, dynamic, not set)
|
|
slurp:
|
|
src: "/boot/config-{{ ansible_kernel }}"
|
|
register: modules
|
|
when: openstack_host_specific_kernel_modules | length > 0
|
|
|
|
- name: Fail fast if we can't load a module
|
|
fail:
|
|
msg: "{{ item.pattern }} is not set"
|
|
with_items: "{{ openstack_host_specific_kernel_modules }}"
|
|
when:
|
|
- item.pattern is defined
|
|
- (modules.content | b64decode).find(item.pattern + ' is not set') != -1
|
|
|
|
- name: "Load kernel module(s)"
|
|
modprobe:
|
|
name: "{{ item.name }}"
|
|
with_items: "{{ openstack_host_kernel_modules + openstack_host_specific_kernel_modules }}"
|
|
when:
|
|
- item.name != ''
|
|
- item.pattern is undefined or (item.pattern is defined and (modules.content | b64decode).find(item.pattern + '=m') != -1)
|
|
|
|
- name: Write list of modules to load at boot
|
|
template:
|
|
src: modprobe.conf.j2
|
|
dest: "{{ openstask_host_module_file }}"
|
|
|
|
- name: Adding new system tuning
|
|
sysctl:
|
|
name: "{{ item.key }}"
|
|
value: "{{ item.value }}"
|
|
sysctl_set: "{{ item.set|default('yes') }}"
|
|
state: "{{ item.state|default('present') }}"
|
|
reload: no
|
|
with_items: "{{ openstack_kernel_options + openstack_user_kernel_options }}"
|
|
failed_when: false
|
|
|
|
- name: Configure sysstat
|
|
include: openstack_sysstat.yml
|
|
when: openstack_host_sysstat_enabled | bool
|
|
|
|
- name: Create a directory to hold systemd journals on disk
|
|
file:
|
|
path: /var/log/journal
|
|
state: directory
|
|
register: journald_directory
|
|
when:
|
|
- openstack_host_keep_journals | bool
|
|
|
|
# NOTE(mhayden): The linter is skipped here since the command does not create
|
|
# any files. The command ensures that proper permissions and SELinux contests
|
|
# are set.
|
|
- name: Create tmpfiles structure in journald directory
|
|
command: systemd-tmpfiles --create --prefix /var/log/journal
|
|
when:
|
|
- journald_directory | changed
|
|
- openstack_host_keep_journals | bool
|
|
notify:
|
|
- Restart systemd-journald
|
|
tags:
|
|
- skip_ansible_lint
|