Skip to content

Commit

Permalink
Speed up APT execution, add SSH pipelining, Add an hd-idle role inste…
Browse files Browse the repository at this point in the history
…ad of hdparm
  • Loading branch information
notthebee committed Sep 9, 2021
1 parent 49aec76 commit d373255
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 41 deletions.
5 changes: 4 additions & 1 deletion ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[defaults]
INVENTORY = hosts
vault_password_file = pass.sh
interpreter_python = python3
ansible_python_interpreter=/usr/bin/python3

[ssh_connection]
pipelining = True
4 changes: 3 additions & 1 deletion group_vars/all/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ host: "{{ duckdns_domain }}.duckdns.org"

ntp_timezone: "{{ timezone }}"

locale: en-us.UTF-8
locale: en_US.UTF-8

keyboard_layout: us

Expand All @@ -33,6 +33,8 @@ boot_drive_serial: ""

enable_pikvm: true

spindown_time: 600 # in seconds

#
# Apt mirrors
#
Expand Down
4 changes: 1 addition & 3 deletions roles/avahi/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
---
- name: Install required system packages
apt:
name: "{{ item }}"
name: avahi-daemon
state: latest
update_cache: yes
with_items:
- 'avahi-daemon'

- name: Copy the main Avahi config
template:
Expand Down
17 changes: 8 additions & 9 deletions roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
---
- name: Install required system packages
apt:
name: "{{ item }}"
name:
- 'apt-transport-https'
- 'ca-certificates'
- 'curl'
- 'software-properties-common'
- 'python3-pip'
- 'virtualenv'
- 'python3-setuptools'
state: latest
update_cache: yes
with_items:
- 'apt-transport-https'
- 'ca-certificates'
- 'curl'
- 'software-properties-common'
- 'python3-pip'
- 'virtualenv'
- 'python3-setuptools'

- name: Ensure group docker exists
group:
Expand Down
10 changes: 7 additions & 3 deletions roles/essential/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@

- name: Install extra packages
apt:
name: "{{ item }}"
name: "{{ extra_packages }}"
state: latest
update_cache: yes
with_items: "{{ extra_packages }}"

- name: Clone the latest dotfiles repo
git:
Expand Down Expand Up @@ -93,4 +92,9 @@

- name: Set the hostname
hostname:
name: "{{ inventory_hostname }}"
name: "{{ inventory_hostname }}"

- name: Generate the locale
locale_gen:
name: "{{ locale }}"
state: present
53 changes: 53 additions & 0 deletions roles/filesystems/hd-idle/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
- name: Check if hd-idle is installed
shell:
cmd: which hd-idle
ignore_errors: true
register: hdidle
changed_when: hdidle.rc != 0

- name: Install hd-idle
when: hdidle.rc != 0
block:

- name: Create the temporary directory
file:
path: /tmp/hd-idle
state: directory

- name: Install github3 module
pip:
name: github3.py

- name: Get the latest release version
github_release:
user: adelolmo
repo: hd-idle
action: latest_release
register: release

- name: print
debug:
var: release

- name: Grab the latest amd64 deb package
get_url:
url: "https://github.com/adelolmo/hd-idle/releases/download/{{ release['tag'] }}/hd-idle_{{ release['tag'] | regex_replace('^v','') }}_amd64.deb"
dest: /tmp/hd-idle

- name: Install the deb package
shell:
cmd: cd /tmp/hd-idle && dpkg -y -i hd-idle*.deb

- name: Install the hd-idle configuration file
template:
src: hd-idle.default.j2
dest: /etc/default/hd-idle

- name: Make sure that hd-idle is started and enabled on boot
systemd:
name: hd-idle
state: started
enabled: yes
masked: no

2 changes: 2 additions & 0 deletions roles/filesystems/hd-idle/templates/hd-idle.default.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
START_HD_IDLE=true
HD_IDLE_OPTS="-i {{ spindown_time }} -l /var/log/hd-idle.log"
2 changes: 0 additions & 2 deletions roles/filesystems/hdparm/defaults/main.yml

This file was deleted.

11 changes: 0 additions & 11 deletions roles/filesystems/hdparm/tasks/main.yml

This file was deleted.

1 change: 0 additions & 1 deletion roles/filesystems/hdparm/templates/69-hdparm.rules.j2

This file was deleted.

4 changes: 1 addition & 3 deletions roles/filesystems/mergerfs/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
- name: Install required system packages
apt:
name: "{{ item }}"
name: "mergerfs"
state: latest
update_cache: yes
with_items:
- 'mergerfs'
9 changes: 4 additions & 5 deletions roles/filesystems/timemachine/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
- name: Install required system packages
apt:
name: "{{ item }}"
name:
- netatalk
- hfsplus
- hfsprogs
state: latest
update_cache: yes
with_items:
- 'netatalk'
- 'hfsplus'
- 'hfsprogs'

- name: Copy the Netatalk config
template:
Expand Down
4 changes: 2 additions & 2 deletions run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
tags:
- snapraid

- role: filesystems/hdparm
- role: filesystems/hd-idle
tags:
- hdparm
- hd-idle

# SMART error checking
- role: stuvusit.smartd
Expand Down

0 comments on commit d373255

Please sign in to comment.