73 lines
1.7 KiB
YAML
73 lines
1.7 KiB
YAML
---
|
|
- name: Geth-Hub packages
|
|
become: yes
|
|
package:
|
|
name:
|
|
- motion
|
|
- lirc
|
|
state: present
|
|
|
|
- name: Copy the SSH key
|
|
authorized_key:
|
|
user: "{{ depriv_user | default('pi') }}"
|
|
state: present
|
|
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/geth.pub') }}"
|
|
|
|
- name: Copy the motion config
|
|
become: yes
|
|
register: motion_config
|
|
copy:
|
|
src: "motion.conf"
|
|
dest: "/etc/motion/motion.conf"
|
|
|
|
- name: Restart the motion service
|
|
become: yes
|
|
when: motion_config.changed
|
|
service:
|
|
name: motion
|
|
state: restarted
|
|
enabled: yes
|
|
|
|
# Thanks to https://wiki.geekworm.com/Raspberry_Pi_IR_Control_Expansion_Board for instructions setting up lirc
|
|
- name: Set the dtoverlay
|
|
become: yes
|
|
lineinfile:
|
|
path: "/boot/config.txt"
|
|
regexp: "^dtoverlay="
|
|
line: "dtoverlay=lirc-rpi,gpio_in_pin={{ gpio_in_pin | default('18') }},gpio_out_pin={{ gpio_out_pin | default('17') }}"
|
|
|
|
- name: Set the dtparam
|
|
become: yes
|
|
lineinfile:
|
|
path: "/boot/config.txt"
|
|
regexp: "^dtparam="
|
|
line: "dtparam=gpio_in_pull={{ gpio_in_pull | default('down') }}"
|
|
|
|
- name: Copy the modules config
|
|
become: yes
|
|
template:
|
|
src: "modules.j2"
|
|
dest: "/etc/modules"
|
|
|
|
- name: Copy lircd supplemental config
|
|
register: lircd_supp_config
|
|
become: yes
|
|
copy:
|
|
src: "hardware.conf"
|
|
dest: "/etc/lirc/hardware.conf"
|
|
|
|
- name: Copy lircd remote config
|
|
register: lircd_remote_config
|
|
become: yes
|
|
copy:
|
|
src: "lircd.conf.{{ inventory_hostname }}"
|
|
dest: /etc/lircd.conf
|
|
|
|
- name: Start the services
|
|
when: lircd_supp_config.changed or lircd_remote_config.changed
|
|
become: yes
|
|
service:
|
|
name: lirc
|
|
state: restarted
|
|
enabled: yes
|