diff --git a/roles/os_config/handlers/main.yml b/roles/os_config/handlers/main.yml index 662c7f5..0fbb6b4 100644 --- a/roles/os_config/handlers/main.yml +++ b/roles/os_config/handlers/main.yml @@ -1,12 +1,36 @@ # vim: ft=yaml.ansible --- +- name: Create .env for apt-update-push + template: + src: env.j2 + dest: "/home/{{ ansible_user }}/apt-update-push/.env" + owner: root + mode: u=rw,go= + listen: apt-update-push + - name: Install apt-update-push - shell: - cmd: "echo 'topic={{ secrets.ntfy_topic }}' > .env && ./install.sh" - stdin: 20 - chdir: "/home/{{ ansible_user }}/apt-update-push" + command: "/home/{{ ansible_user }}/apt-update-push/install.sh" + listen: apt-update-push + +- name: Change GPIO_PIN + lineinfile: + regexp: '^GPIO_PIN = ' + line: GPIO_PIN = 14 + dest: "/home/{{ ansible_user }}/pi-fan-controller/fancontrol.py" + listen: pi-fan-controller + +- name: Install requirements for pi-fan-controller + pip: + requirements: "/home/{{ ansible_user }}/pi-fan-controller/requirements.txt" + executable: pip3 + listen: pi-fan-controller + +- name: Install pi-fan-controller + command: "/home/{{ ansible_user }}/pi-fan-controller/script/install" + listen: pi-fan-controller - name: Restart sshd service: name: sshd state: restarted + listen: sshd diff --git a/roles/os_config/tasks/base.yml b/roles/os_config/tasks/base.yml index d541752..ca83195 100644 --- a/roles/os_config/tasks/base.yml +++ b/roles/os_config/tasks/base.yml @@ -37,4 +37,15 @@ single_branch: true depth: 1 become: false - notify: Install apt-update-push + notify: apt-update-push + +- name: Clone pi-fan-controller + git: + dest: "/home/{{ ansible_user }}/pi-fan-controller" + repo: https://github.com/Howchoo/pi-fan-controller.git + clone: true + update: false + single_branch: true + depth: 1 + become: false + notify: pi-fan-controller diff --git a/roles/os_config/tasks/ssh.yml b/roles/os_config/tasks/ssh.yml index fb3a57a..7f85311 100644 --- a/roles/os_config/tasks/ssh.yml +++ b/roles/os_config/tasks/ssh.yml @@ -11,18 +11,18 @@ regexp: '^#?PubkeyAuthentication ' line: PubkeyAuthentication yes dest: /etc/ssh/sshd_config - notify: Restart sshd + notify: sshd - name: Disallow SSH login with password lineinfile: regexp: '^#?PasswordAuthentication ' line: PasswordAuthentication no dest: /etc/ssh/sshd_config - notify: Restart sshd + notify: sshd - name: Disallow root login over SSH lineinfile: regexp: '^#?PermitRootLogin ' line: PermitRootLogin no dest: /etc/ssh/sshd_config - notify: Restart sshd + notify: sshd diff --git a/roles/os_config/templates/env.j2 b/roles/os_config/templates/env.j2 new file mode 100644 index 0000000..3f25473 --- /dev/null +++ b/roles/os_config/templates/env.j2 @@ -0,0 +1,2 @@ +topic={{ secrets.ntfy_topic }} +hour=20