summaryrefslogtreecommitdiff
path: root/roles/common/tasks/main.yml
blob: 7e81c55e0a94c4b62d967849af7e55a2ada98eaa (plain) (blame)
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
---
- name: install common packages
  apt: name={{item}} state=latest
  with_items:
    - ufw
    - openssl
    - ca-certificates
    - curl
    - wget
    - jq
    - rsync

- name: firewall - allow ssh
  ufw: rule=allow port=22 proto=tcp

- name: firewall - enforce rules and deny by default
  ufw: state=enabled policy=deny

- name: forward root email
  lineinfile: "dest=/etc/aliases regexp='root:' line='root: infra@odersky.com'"

- name: unattended upgrades - install
  apt: name={{item}} state=latest
  with_items:
    - unattended-upgrades
    - apt-listchanges

- name: unattended upgrades - configure email
  lineinfile:
    dest=/etc/apt/apt.conf.d/50unattended-upgrades
    regexp='//Unattended-Upgrade::Mail "root";'
    line='Unattended-Upgrade::Mail "root";'
    backrefs=yes

- name: unattended upgrades - enable
  copy:
    content: |
      APT::Periodic::Update-Package-Lists "1";
      APT::Periodic::Unattended-Upgrade "1";
    dest: /etc/apt/apt.conf.d/20auto-upgrades