Put logrotate,iptables,snapper and smartd to common

This commit is contained in:
Daniel A. Maierhofer
2018-07-13 14:20:25 +02:00
parent 44bfc1367f
commit cf86ac1833
12 changed files with 8 additions and 85 deletions

View File

@@ -52,3 +52,7 @@ common_sysctls:
- key: net.ipv4.conf.default.accept_source_route
val: 0
common_snapper: True
common_smartd: True

View File

@@ -2,6 +2,9 @@
inventory_hostname: ariane.fet.htu.tuwien.ac.at
inventory_hostname_short: ariane
common_iptables_v4: "iptables_ariane_v4.j2"
common_iptables_v6: "iptables_ariane_v6.j2"
lxc:
containers:
- name: laika

View File

@@ -1,8 +1,4 @@
---
ariane_logrotate: True
ariane_iptables: True
ariane_zfs: True
ariane_lxc: True
ariane_lxc_void: True
ariane_snapper: True
ariane_smartd: True

View File

@@ -1,7 +1,4 @@
---
- name: iptables restore
command: iptables-restore /etc/iptables/rules.v4
- name: zfs - start services
service: "name={{ item }} state=restarted"
with_items:
@@ -11,12 +8,6 @@
- zfs-share
listen: zfs restart
- name: snapper - reload fstab
command: mount -a
- name: restart smartd
service: name=smartd state=restarted
- name: lxc - create authorized_keys file in VM for root
listen: lxc - inital ssh authorized_keys
copy: remote_src=yes src=/root/.ssh/authorized_keys dest="/var/lib/lxc/lxc-{{ item.name }}-{{ item.revision }}/rootfs/root/.ssh/authorized_keys" owner=root group=root mode=0600

View File

@@ -1,13 +0,0 @@
---
- name: iptables - install iptables-persistent
package: name=iptables-persistent
- name: /etc/iptables/rules.v4
template: dest=/etc/iptables/rules.v4 src=iptables_rules_v4.j2 owner=root group=root mode=0644
notify:
iptables restore
- name: /etc/iptables/rules.v6
template: dest=/etc/iptables/rules.v6 src=iptables_rules_v6.j2 owner=root group=root mode=0644
notify:
iptables restore

View File

@@ -1,6 +0,0 @@
---
- name: logrotate - set backlog
lineinfile:
path: /etc/logrotate.conf
regexp: '^rotate '
line: 'rotate 52'

View File

@@ -1,12 +1,4 @@
---
- import_tasks: logrotate.yml
when: ariane_logrotate
tags: ['ariane_logrotate', 'logrotate']
- import_tasks: iptables.yml
when: ariane_iptables
tags: ['ariane_iptables', 'iptables']
- import_tasks: zfs.yml
when: ariane_zfs
tags: ['ariane_zfs', 'zfs']
@@ -18,11 +10,3 @@
- import_tasks: lxc_void.yml
when: ariane_lxc_void
tags: ['ariane_lxc_void', 'lxc', 'lxc_void']
- import_tasks: snapper.yml
when: ariane_snapper
tags: ['ariane_snapper', 'snapper']
- import_tasks: smartd.yml
when: ariane_smartd
tags: ['ariane_smartd', 'smartd']

View File

@@ -1,16 +0,0 @@
---
- name: smartd - install smartmontools
package: name=smartmontools
- name: smartd - /etc/default/smartmontools
replace:
path: /etc/default/smartmontools
regexp: "^#start_smartd=.*"
replace: "start_smartd=yes"
notify: restart smartd
- name: smartd - /etc/smartd.conf
copy:
dest: /etc/smartd.conf
content: "DEVICESCAN -a -d nvme -d sat -o on -s (S/../.././01) -n standby -R 5 -I 9 -R 194 -m root -M exec /usr/share/smartmontools/smartd-runner\n"
notify: restart smartd

View File

@@ -1,20 +0,0 @@
---
- name: snapper - install snapper
package: name=snapper
- name: snapper - create-config
command: snapper create-config /
args:
creates: /etc/snapper/configs/root
- name: snapper - get rootfs blkid
shell: "blkid -s UUID|grep `mount|grep '/ '|cut -d' ' -f1`|cut -d' ' -f 2"
register: snapper_blkid
changed_when: False
- name: snapper - /etc/fstab
lineinfile:
path: /etc/fstab
line: "{{ snapper_blkid.stdout_lines[0] }} /.snapshots btrfs subvol=.snapshots 0 1"
when: snapper_blkid.stdout_lines is defined
notify: snapper - reload fstab