2021-04-10 22:11:19 +02:00
|
|
|
---
|
|
|
|
# vim: set expandtab tabstop=2 shiftwidth=2:
|
|
|
|
|
|
|
|
- name: etckeeper initialized
|
|
|
|
shell: |
|
|
|
|
set -e
|
|
|
|
[ -f /etc/.git/config ] && exit 42
|
|
|
|
echo "Need to init"
|
|
|
|
etckeeper init
|
|
|
|
register: etckeeper_init
|
|
|
|
changed_when: 'etckeeper_init.rc == 0'
|
|
|
|
failed_when: 'etckeeper_init.rc not in [0,42]'
|
|
|
|
|
|
|
|
- name: set git-defaults
|
|
|
|
git_config:
|
|
|
|
name: '{{item.key}}'
|
|
|
|
repo: /etc
|
|
|
|
scope: local
|
|
|
|
value: '{{item.value}}'
|
|
|
|
with_dict:
|
|
|
|
user.email: '{{etckeeper.email}}'
|
|
|
|
user.name: '{{etckeeper.name}}'
|
|
|
|
- name: pre etckeeper commit
|
|
|
|
shell: |
|
|
|
|
set -e
|
|
|
|
dd if=/dev/urandom of=/etc/.etckeeper_random count=1
|
|
|
|
etckeeper commit 'pre ansible sys'
|
|
|
|
|
|
|
|
- name: create group syslog
|
|
|
|
group: {name: syslog, system: yes}
|
|
|
|
|
|
|
|
- name: enable rng-tools
|
|
|
|
when: has_hwrng
|
|
|
|
systemd:
|
|
|
|
name: rng-tools
|
|
|
|
enabled: yes
|
|
|
|
|
|
|
|
- name: Set timezone variables
|
|
|
|
file:
|
|
|
|
src: '/usr/share/zoneinfo/{{timezone}}'
|
|
|
|
dest: /etc/localtime
|
|
|
|
state: link
|
|
|
|
force: yes
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
|
|
|
|
- name: install systemd-logcompress-jobs
|
|
|
|
copy:
|
|
|
|
src: "{{item}}"
|
|
|
|
dest: /etc/systemd/system
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
with_fileglob:
|
|
|
|
- "systemd/system/*"
|
|
|
|
|
2024-09-19 23:35:42 +02:00
|
|
|
- name: install systemd-logcompress-jobs
|
|
|
|
template:
|
|
|
|
src: "{{item}}"
|
|
|
|
dest: /etc/systemd/system
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
with_fileglob:
|
|
|
|
- "systemd/system/*"
|
|
|
|
vars:
|
|
|
|
command: '{{ logcompress_command | default( logcompress_compression_commands[ logcompress_algo | default( "zstd") ] ) }}'
|
|
|
|
|
2021-04-10 22:11:19 +02:00
|
|
|
- name: enable services
|
|
|
|
systemd:
|
|
|
|
name: "{{item}}"
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
|
|
|
with_items:
|
|
|
|
- rsyslog
|
|
|
|
- logcompress.timer
|