author | Luke Hoersten <luke@hoersten.org> |
Fri, 01 May 2020 17:58:26 -0500 | |
changeset 13 | c74df4bbd49d |
parent 10 | 524cf40846b3 |
child 14 | 47937f95ac26 |
permissions | -rw-r--r-- |
0
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
1 |
--- |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
2 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
3 |
- name: turn swap off |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
4 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
5 |
command: "swapoff -a" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
6 |
changed_when: false |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
7 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
8 |
- name: remove swap apt package |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
9 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
10 |
apt: state="absent" name="dphys-swapfile" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
11 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
12 |
- name: add log2ram apt key |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
13 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
14 |
apt_key: url="https://azlux.fr/repo.gpg.key" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
15 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
16 |
- name: add log2ram apt repo |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
17 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
18 |
apt_repository: repo="deb http://packages.azlux.fr/debian/ buster main" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
19 |
|
13 | 20 |
- name: configure log2ram disk size |
21 |
become: yes |
|
22 |
lineinfile: |
|
23 |
path: "/etc/log2ram.conf" |
|
24 |
regexp: "^SIZE=" |
|
25 |
line: "SIZE={{rpi_base_log_size}}" |
|
26 |
notify: restart log2ram service |
|
27 |
||
0
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
28 |
- name: set timezone |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
29 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
30 |
timezone: name="{{rpi_base_timezone}}" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
31 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
32 |
- name: setup wifi |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
33 |
become: yes |
7
dc3fca0131a7
Updated some permissions on conf files
Luke Hoersten <luke@hoersten.org>
parents:
3
diff
changeset
|
34 |
template: src="wpa_supplicant.conf.j2" dest="/etc/wpa_supplicant/wpa_supplicant.conf" mode="0600" |
0
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
35 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
36 |
- name: update apt package cache |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
37 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
38 |
apt: upgrade="dist" autoremove="yes" autoclean="yes" update_cache="yes" cache_valid_time="3600" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
39 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
40 |
- name: install extra apt packages |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
41 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
42 |
apt: name="{{rpi_base_apt_packages}}" state="latest" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
43 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
44 |
- name: install fail2ban config |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
45 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
46 |
copy: src="jail.local" dest="/etc/fail2ban/jail.local" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
47 |
|
10
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
48 |
- name: add users |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
49 |
become: yes |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
50 |
user: |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
51 |
name: "{{admin_user_name}}" |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
52 |
password: "{{admin_user_password}}" |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
53 |
groups: "sudo,users" |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
54 |
append: yes |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
55 |
|
0
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
56 |
- name: authorize admin ssh keys |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
57 |
become: yes |
10
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
58 |
authorized_key: user="{{admin_user_name}}" key="https://github.com/{{github_user}}.keys" |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
59 |
|
13 | 60 |
- name: authorize ssh keys |
10
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
61 |
become: yes |
0
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
62 |
authorized_key: user="{{ansible_user}}" key="https://github.com/{{github_user}}.keys" |
10
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
63 |
|
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
64 |
- name: nopasswd sudo for admin user |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
65 |
become: yes |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
66 |
template: |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
67 |
src: "010_admin-nopasswd" |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
68 |
dest: "/etc/sudoers.d/010_admin-nopasswd" |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
69 |
|
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
70 |
- name: disable ssh password login |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
71 |
become: yes |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
72 |
lineinfile: |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
73 |
path: "/etc/ssh/sshd_config" |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
74 |
regexp: "^PasswordAuthentication" |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
75 |
insertafter: "^#PasswordAuthentication" |
524cf40846b3
Added better use for admin user.
Luke Hoersten <luke@hoersten.org>
parents:
7
diff
changeset
|
76 |
line: "PasswordAuthentication no" |