From c8132233aef99680bee63768d6ca11f9d9fa5b05 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 14 Jan 2022 18:40:54 +0200 Subject: [PATCH] Move infra-journal-remote logic to its role Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/824731 Change-Id: I125a34e87925de1c245c1cbc922689b56735e7d4 --- playbooks/infra-journal-remote.yml | 102 +---------------------------- 1 file changed, 1 insertion(+), 101 deletions(-) diff --git a/playbooks/infra-journal-remote.yml b/playbooks/infra-journal-remote.yml index 25cdd85134..c11f31e33a 100644 --- a/playbooks/infra-journal-remote.yml +++ b/playbooks/infra-journal-remote.yml @@ -22,107 +22,7 @@ - name: Install Journal-Remote hosts: hosts gather_facts: false - become: true - handlers: - - name: Restart systemd-journald - systemd: - name: systemd-journald - state: restarted - pre_tasks: - - name: Skip playbook if log_hosts group is empty - meta: end_play - when: - - groups['log_hosts'] | length == 0 - - - name: Install systemd-journal-remote - package: - name: "{{ systemd_journal_remote_distro_package[ansible_facts['pkg_mgr']] }}" - state: "{{ package_state }}" - - - name: Ensure systemd-journal-remote socket is enabled on receiving host - systemd: - name: systemd-journal-remote.socket - enabled: yes - state: started - when: - - (ansible_host == systemd_journal_remote_target) - - - name: Create journal directory - file: - path: "/var/log/journal" - state: "directory" - owner: "root" - group: "systemd-journal" - - - name: Create journal remote directory - file: - path: "/var/log/journal/remote" - state: "directory" - owner: "systemd-journal-remote" - group: "systemd-journal" - - - name: Ensure receiving hosts are tuned - ini_file: - path: "/etc/systemd/journald.conf" - section: Journal - option: "{{ item.key }}" - value: "{{ item.value }}" - backup: yes - with_items: - - key: RuntimeMaxFiles - value: "{{ ((((groups['hosts'] | length) * 1.5) + (groups['hosts'] | length)) // 1) | int }}" - - key: RuntimeMaxFileSize - value: "5G" - - key: Compress - value: "yes" - - key: MaxFileSec - value: "1d" - - key: MaxRetentionSec - value: "2d" - when: - - (ansible_host == systemd_journal_remote_target) - notify: - - Restart systemd-journald - roles: - - role: "systemd_service" - systemd_tempd_prefix: "openstack" - systemd_CPUAccounting: true - systemd_BlockIOAccounting: true - systemd_MemoryAccounting: true - systemd_TasksAccounting: true - systemd_services: - - service_name: "systemd-journal-remote" - enabled: "{{ (ansible_host != systemd_journal_remote_target) | ternary('no', 'yes') }}" - state: "{{ (ansible_host != systemd_journal_remote_target) | ternary('stopped', 'started') }}" - execstarts: >- - /lib/systemd/systemd-journal-remote - --listen-http=-3 - --split-mode=host - --compress - --seal - --output=/var/log/journal/remote/ - config_overrides: - Unit: - Requires: "systemd-journal-remote.socket" - - - service_name: "systemd-journal-upload" - enabled: "{{ (ansible_host == systemd_journal_remote_target) | ternary('no', 'yes') }}" - state: "{{ (ansible_host == systemd_journal_remote_target) | ternary('stopped', 'started') }}" - execstarts: >- - /lib/systemd/systemd-journal-upload - --save-state - --merge - --url=http://{{ systemd_journal_remote_target }}:19532 - dynamic_user: true - state_directory: systemd/journal-upload - - vars: - systemd_journal_remote_target: "{{ hostvars[groups['log_hosts'][0]]['ansible_host'] }}" - systemd_journal_remote_distro_package: - apt: "systemd-journal-remote" - yum: "systemd-journal-gateway" - dnf: "systemd-journal-gateway" - + - openstack.osa.journald_remote tags: - journal-remote