From 68251ff9a5253cc5d89dbd7edb949c1b2337a790 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Wed, 24 Mar 2021 07:26:39 +0000 Subject: [PATCH] Bugfixes and enhacements (#1) * Fix mounts issue after complete cluster shutdown. * Add pimoroni fan shim support. --- step2/roles/common/tasks/fan-support.yml | 35 ++++++++++++++++++++++++ step2/roles/common/tasks/kubernetes.yml | 1 + step2/roles/common/tasks/main.yml | 4 ++- step2/roles/common/tasks/nfs.yml | 5 +++- step2/rpi.yaml | 1 + step2/static/pi-fans | 8 ++++++ 6 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 step2/roles/common/tasks/fan-support.yml create mode 100644 step2/static/pi-fans diff --git a/step2/roles/common/tasks/fan-support.yml b/step2/roles/common/tasks/fan-support.yml new file mode 100644 index 0000000..aa09507 --- /dev/null +++ b/step2/roles/common/tasks/fan-support.yml @@ -0,0 +1,35 @@ +--- +- name: Install packages - fan support + ansible.builtin.package: + name: + - git + - go + state: present + +- name: PiMoroni fan shim repo + ansible.builtin.git: + repo: 'https://github.com/lukaszraczylo/fanshim-go.git' + dest: /srv/pimoroni-fans + force: yes + +- name: Install pimoroni fans + ansible.builtin.shell: + chdir: /srv/pimoroni-fans + cmd: | + go build -o /usr/bin/fans + creates: /usr/bin/fans + +- name: Copy startup script + ansible.builtin.copy: + src: static/pi-fans + dest: /etc/init.d/fans + owner: root + group: root + mode: '0744' + backup: no + +- name: Start and enable fans service + ansible.builtin.service: + name: fans + state: restarted + enabled: yes \ No newline at end of file diff --git a/step2/roles/common/tasks/kubernetes.yml b/step2/roles/common/tasks/kubernetes.yml index c833e2d..db86f96 100644 --- a/step2/roles/common/tasks/kubernetes.yml +++ b/step2/roles/common/tasks/kubernetes.yml @@ -2,6 +2,7 @@ - name: Pull basic images ansible.builtin.shell: cmd: kubeadm config images pull + creates: /etc/kubernetes/kubelet.conf - name: Install helm ansible.builtin.shell: diff --git a/step2/roles/common/tasks/main.yml b/step2/roles/common/tasks/main.yml index 36a4440..4833579 100644 --- a/step2/roles/common/tasks/main.yml +++ b/step2/roles/common/tasks/main.yml @@ -6,4 +6,6 @@ when: basic_config_lock.stat.exists == False - include: networking.yml - include: kubernetes.yml -- include: nfs.yml \ No newline at end of file +- include: nfs.yml +- include: fan-support.yml + when: settings.pimoroni_fans_enabled == "enabled" \ No newline at end of file diff --git a/step2/roles/common/tasks/nfs.yml b/step2/roles/common/tasks/nfs.yml index 4a9281a..3e1d392 100644 --- a/step2/roles/common/tasks/nfs.yml +++ b/step2/roles/common/tasks/nfs.yml @@ -16,6 +16,7 @@ fstype: nfs opts: nofail,noatime,nolock,tcp,actimeo=1800 state: mounted + boot: yes - name: Mount NFS torrent ansible.posix.mount: @@ -24,6 +25,7 @@ fstype: nfs opts: nofail,noatime,nolock,tcp,actimeo=1800 state: mounted + boot: yes - name: Mount NFS adguard ansible.posix.mount: @@ -31,4 +33,5 @@ path: /mnt/drobo-storage/docker-volumes/adguard fstype: nfs opts: nofail,noatime,nolock,tcp,actimeo=1800 - state: mounted \ No newline at end of file + state: mounted + boot: yes \ No newline at end of file diff --git a/step2/rpi.yaml b/step2/rpi.yaml index 7b74cd9..6748d0d 100644 --- a/step2/rpi.yaml +++ b/step2/rpi.yaml @@ -6,6 +6,7 @@ nfs_torrent_path: "/mnt/drobo-storage/docker-volumes/torrent" nfs_adguard_path: "/mnt/drobo-storage/docker-volumes/adguard" nfs_multi_share_path: "/mnt/drobo-storage/docker-volumes/nfs-share" + pimoroni_fans_enabled: "enabled" roles: - common diff --git a/step2/static/pi-fans b/step2/static/pi-fans new file mode 100644 index 0000000..d97571e --- /dev/null +++ b/step2/static/pi-fans @@ -0,0 +1,8 @@ +#!/sbin/openrc-run + +name="fans $RC_SVCNAME" +command="/usr/bin/fans" +command_args="-brightness 5 --on-threshold 65 --off-threshold 50 -extended-colors" +command_user="root" +pidfile="/run/$RC_SVCNAME.pid" +command_background="yes" \ No newline at end of file