mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 02:10:05 +00:00 
			
		
		
		
	Another big round of refactoring and cleaning...
This commit is contained in:
		
							
								
								
									
										32
									
								
								roles/sys-svc-journalctl/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								roles/sys-svc-journalctl/README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| # Journalctl | ||||
|  | ||||
| This Ansible role manages the configuration of `systemd-journald` on target hosts. | ||||
|  | ||||
| ## Description | ||||
|  | ||||
| - Copies a customized `journald.conf` to `/etc/systemd/journald.conf`   | ||||
| - Ensures log retention for one week   | ||||
| - Restarts the `systemd-journald` service when configuration changes   | ||||
| - Supports live log streaming via `journalctl -f` | ||||
|  | ||||
| ## Overview | ||||
|  | ||||
| 1. **Template deployment**   | ||||
|    The role places your `journald.conf.j2` template into `/etc/systemd/journald.conf`. | ||||
| 2. **Service handler**   | ||||
|    On change, it notifies a handler to restart `systemd-journald`. | ||||
| 3. **Monitoring**   | ||||
|    You can follow logs in real time with `journalctl -f`. | ||||
|  | ||||
| ## Features | ||||
|  | ||||
| - Customizable retention and runtime limits   | ||||
| - Seamless restarts on config update   | ||||
| - Integration with `sys-hlth-journalctl` for downstream monitoring | ||||
|  | ||||
| ## Usage | ||||
|  | ||||
| ```yaml | ||||
| - hosts: all | ||||
|   roles: | ||||
|     - role: sys-svc-journalctl | ||||
							
								
								
									
										3
									
								
								roles/sys-svc-journalctl/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								roles/sys-svc-journalctl/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| --- | ||||
| - name: restart systemd-journald | ||||
|   service: name=systemd-journald state=restarted | ||||
							
								
								
									
										20
									
								
								roles/sys-svc-journalctl/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								roles/sys-svc-journalctl/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| --- | ||||
| galaxy_info: | ||||
|   author: "Kevin Veen-Birkenbach" | ||||
|   description: "Configure and manage systemd-journald settings" | ||||
|   license: "CyMaIS NonCommercial License (CNCL)" | ||||
|   license_url: "https://s.veen.world/cncl" | ||||
|   company: | | ||||
|     Kevin Veen-Birkenbach | ||||
|     Consulting & Coaching Solutions | ||||
|     https://www.veen.world | ||||
|   galaxy_tags: | ||||
|     - system | ||||
|     - logging | ||||
|     - journald | ||||
|   repository: "https://github.com/kevinveenbirkenbach/cymais" | ||||
|   issue_tracker_url: "https://github.com/kevinveenbirkenbach/cymais/issues" | ||||
|   documentation: "https://github.com/kevinveenbirkenbach/cymais/roles/sys-svc-journalctl" | ||||
|   run_after: [] | ||||
| dependencies: | ||||
|   - sys-hlth-journalctl | ||||
							
								
								
									
										5
									
								
								roles/sys-svc-journalctl/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								roles/sys-svc-journalctl/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| - name: copy journald.conf | ||||
|   template:  | ||||
|     src: templates/journald.conf.j2 | ||||
|     dest: /etc/systemd/journald.conf | ||||
|   notify: restart systemd-journald | ||||
							
								
								
									
										47
									
								
								roles/sys-svc-journalctl/templates/journald.conf.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								roles/sys-svc-journalctl/templates/journald.conf.j2
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | ||||
| #  This file is part of systemd. | ||||
| # | ||||
| #  systemd is free software; you can redistribute it and/or modify it | ||||
| #  under the terms of the GNU Lesser General Public License as published by | ||||
| #  the Free Software Foundation; either version 2.1 of the License, or | ||||
| #  (at your option) any later version. | ||||
| # | ||||
| # Entries in this file show the compile time defaults. | ||||
| # You can change settings by editing this file. | ||||
| # Defaults can be restored by simply deleting this file. | ||||
| # | ||||
| # See journald.conf(5) for details. | ||||
|  | ||||
| [Journal] | ||||
| #Storage=auto | ||||
| #Compress=yes | ||||
| #Seal=yes | ||||
| #SplitMode=uid | ||||
| #SyncIntervalSec=5m | ||||
| #RateLimitIntervalSec=30s | ||||
| #RateLimitBurst=10000 | ||||
| #SystemMaxUse= | ||||
| #SystemKeepFree= | ||||
| #SystemMaxFileSize= | ||||
| #SystemMaxFiles=100 | ||||
| #RuntimeMaxUse= | ||||
| #RuntimeKeepFree= | ||||
| #RuntimeMaxFileSize= | ||||
| #RuntimeMaxFiles=100 | ||||
|  | ||||
| # Store logs for one week: | ||||
| MaxRetentionSec=604800 | ||||
|  | ||||
| #MaxFileSec=1month | ||||
| #ForwardToSyslog=no | ||||
| #ForwardToKMsg=no | ||||
| #ForwardToConsole=no | ||||
| #ForwardToWall=yes | ||||
| #TTYPath=/dev/console | ||||
| #MaxLevelStore=debug | ||||
| #MaxLevelSyslog=debug | ||||
| #MaxLevelKMsg=notice | ||||
| #MaxLevelConsole=info | ||||
| #MaxLevelWall=emerg | ||||
| #LineMax=48K | ||||
| #ReadKMsg=yes | ||||
| #Audit=yes | ||||
		Reference in New Issue
	
	Block a user