Created
March 2, 2021 06:11
-
-
Save IllyaMoskvin/8b5fb5e6386cc953e6e96c2bfbafae74 to your computer and use it in GitHub Desktop.
Installing hd-idle via Ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path: roles/nas/handlers/main.yml | |
- name: restart hd-idle | |
service: | |
name: hd-idle | |
state: restarted | |
daemon_reload: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path: roles/nas/tasks/main.yml | |
# https://github.com/adelolmo/hd-idle | |
- name: check if hd-idle is installed | |
command: dpkg-query -W hd-idle | |
register: hd_idle_check_deb | |
failed_when: hd_idle_check_deb.rc > 1 | |
changed_when: hd_idle_check_deb.rc == 1 | |
- name: install hd-idle package | |
when: hd_idle_check_deb.rc == 1 | |
block: | |
- name: copy hd-idle to host | |
copy: | |
src: templates/hd-idle_1.12_armhf.deb | |
dest: /tmp/hd-idle_1.12_armhf.deb | |
- name: install hd-idle | |
apt: | |
deb: /tmp/hd-idle_1.12_armhf.deb | |
- name: delete hd-idle from host | |
file: | |
path: /tmp/hd-idle_1.12_armhf.deb | |
state: absent | |
- name: deploy /etc/default/hd-idle | |
copy: | |
src: templates/hd-idle | |
dest: /etc/default/hd-idle | |
notify: | |
- restart hd-idle | |
- name: start hd-idle on boot | |
service: | |
name: hd-idle | |
enabled: true | |
state: started |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path: roles/nas/templates/hd-idle | |
# start hd-idle automatically | |
START_HD_IDLE=true | |
# this idles hard drives after 60 seconds as a demonstration; change to a more conservative value! | |
HD_IDLE_OPTS="-a /dev/sda -i 60 -a /dev/sdb -i 60 -a /dev/sdc -i 60 -a /dev/sdd -i 60 -l /var/log/hd-idle.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path: roles/nas/templates/hd-idle_1.12_armhf.deb | |
Go download the v1.12 release from here: | |
https://github.com/adelolmo/hd-idle/releases/tag/v1.12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment