Skip to content

Instantly share code, notes, and snippets.

@dapi
Created August 17, 2021 09:25
Show Gist options
  • Save dapi/ca27964ccc7a8456da87c4a04fd5fdf3 to your computer and use it in GitHub Desktop.
Save dapi/ca27964ccc7a8456da87c4a04fd5fdf3 to your computer and use it in GitHub Desktop.
- hosts: all
tasks:
- name: Create users systemd subdirectories
become: yes
become_user: "{{ app_user }}"
file:
path: "/home/{{ app_user }}/.config/systemd/user"
state: directory
mode: 0775
- name: Enable linger for app_user
command: "loginctl enable-linger {{app_user}}"
- name: Comment DNS section
replace:
path: /etc/systemd/resolved.conf
regexp: '^(DNS=.*)'
replace: '#\1'
notify:
- systemd daemon reload
- name: Uncommenting ForwardToSyslog
replace:
path: /etc/systemd/journald.conf
regexp: '^#(ForwardToSyslog.*)'
replace: '\1'
notify:
- systemd daemon reload
- name: Change SystemMaxUse to 100mb
lineinfile:
path: /etc/systemd/journald.conf
regexp: '^#(SystemMaxUse*)'
line: 'SystemMaxUse=100M'
backrefs: yes
- name: Restart systemd-resolved
systemd:
state: restarted
name: systemd-resolved
handlers:
- name: systemd daemon reload
command: systemctl daemon-reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment