aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/general.yml
blob: df24be2c97474702003b9dae702d508d2528adbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
- name: Install packages
  package:
    name: "{{ item }}"
    state: present
  loop:
    - rsync
    - dma
    - jq
    - curl
    - bash

- name: Set up periodic.conf
  template:
    src: etc_periodic.conf.j2
    dest: /etc/periodic.conf
    owner: root
    group: wheel
    mode: "0644"

- name: Set up /etc/rc.conf
  template:
    src: etc_rc.conf.j2
    dest: /etc/rc.conf
    owner: root
    group: wheel
    mode: "0644"
  register: rc_conf

- name: Set up fstab
  template:
    src: etc_fstab.j2
    dest: /etc/fstab
    owner: root
    group: wheel
    mode: "0644"
  register: fstab

- name: Run mount -a
  shell: mount -a
  when: fstab.changed

- name: Start auditd
  service:
    name: auditd
    state: started

- name: Set up crontab
  template:
    src: etc_crontab.j2
    dest: /etc/crontab
    owner: root
    group: wheel
    mode: "0644"
  register: etc_crontab

- name: Restart cron
  service:
    name: cron
    state: restarted
  when: etc_crontab.changed

- name: Install logto
  template:
    src: usr_local_bin_logto.sh.j2
    dest: /usr/local/bin/logto
    owner: root
    group: wheel
    mode: "0755"

- name: Copy backup SSH private key
  copy:
    src: "{{ backup_ssh_privkey_file }}"
    dest: /root/.ssh/backup
    owner: root
    group: wheel
    mode: "0600"

- name: Copy backup SSH public key
  copy:
    src: "{{ backup_ssh_pubkey_file }}"
    dest: /root/.ssh/backup.pub
    owner: root
    group: wheel
    mode: "0644"

- name: Copy SSH config
  template:
    src: root_ssh_config.j2
    dest: /root/.ssh/config
    owner: root
    group: wheel
    mode: "0644"

- name: Copy backup script
  template:
    src: usr_local_bin_backup.sh.j2
    dest: /usr/local/bin/backup
    owner: root
    group: wheel
    mode: "0755"