Catching up with current successes
This commit is contained in:
@@ -1,15 +1,24 @@
|
||||
---
|
||||
- name: Update the apt sources
|
||||
become: yes
|
||||
copy:
|
||||
src: "sources.list"
|
||||
dest: "/etc/apt/sources.list"
|
||||
|
||||
- name: Geth-Hub packages
|
||||
become: yes
|
||||
package:
|
||||
name:
|
||||
- motion
|
||||
- lirc
|
||||
- libcamera-apps
|
||||
- ir-keytable
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Copy the SSH key
|
||||
authorized_key:
|
||||
user: "{{ depriv_user | default('pi') }}"
|
||||
user: "{{ ansible_user_id }}"
|
||||
state: present
|
||||
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/geth.pub') }}"
|
||||
|
||||
@@ -17,27 +26,53 @@
|
||||
become: yes
|
||||
register: motion_config
|
||||
copy:
|
||||
src: "motion.conf"
|
||||
src: "motion.conf/{{ inventory_hostname }}"
|
||||
dest: "/etc/motion/motion.conf"
|
||||
|
||||
- name: Create motion log folder
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: motion
|
||||
group: motion
|
||||
mode: 0750
|
||||
loop:
|
||||
- "/var/log/motion"
|
||||
- "/var/run/motion"
|
||||
|
||||
- name: Restart the motion service
|
||||
become: yes
|
||||
when: motion_config.changed
|
||||
when: motion_config.changed and motion_enabled
|
||||
service:
|
||||
name: motion
|
||||
state: restarted
|
||||
enabled: yes
|
||||
|
||||
- name: Allow override of motion service
|
||||
become: yes
|
||||
when: not motion_enabled
|
||||
service:
|
||||
name: motion
|
||||
state: stopped
|
||||
enabled: no
|
||||
|
||||
|
||||
# Thanks to https://wiki.geekworm.com/Raspberry_Pi_IR_Control_Expansion_Board for instructions setting up lirc
|
||||
- name: Set the dtoverlay
|
||||
become: yes
|
||||
lineinfile:
|
||||
register: dtoverlay
|
||||
blockinfile:
|
||||
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') }}"
|
||||
insertafter: EOF
|
||||
marker: "# {mark} Ubiqtorate Managed Block"
|
||||
block: |
|
||||
dtoverlay=gpio-ir,gpio_pin={{ gpio_in_pin | default('18') }}
|
||||
dtoverlay=gpio-ir-tx,gpio_pin={{ gpio_out_pin | default('17') }}
|
||||
|
||||
- name: Set the dtparam
|
||||
become: yes
|
||||
register: dtparam
|
||||
lineinfile:
|
||||
path: "/boot/config.txt"
|
||||
regexp: "^dtparam="
|
||||
@@ -45,10 +80,28 @@
|
||||
|
||||
- name: Copy the modules config
|
||||
become: yes
|
||||
register: modules_config
|
||||
template:
|
||||
src: "modules.j2"
|
||||
dest: "/etc/modules"
|
||||
|
||||
- name: Copy the modules config, part 2
|
||||
become: yes
|
||||
register: modules_config_2
|
||||
template:
|
||||
src: "lirc_rpi.conf.j2"
|
||||
dest: "/etc/modprobe.d/lirc_rpi.conf"
|
||||
|
||||
- name: Reboot if needed
|
||||
become: yes
|
||||
when: modules_config.changed or dtparam.changed or dtoverlay.changed or modules_config_2.changed
|
||||
reboot:
|
||||
|
||||
- name: Wait if needed
|
||||
become: yes
|
||||
when: modules_config.changed or dtparam.changed or dtoverlay.changed or modules_config_2.changed
|
||||
wait_for_connection:
|
||||
|
||||
- name: Copy lircd supplemental config
|
||||
register: lircd_supp_config
|
||||
become: yes
|
||||
@@ -60,13 +113,13 @@
|
||||
register: lircd_remote_config
|
||||
become: yes
|
||||
copy:
|
||||
src: "lircd.conf.{{ inventory_hostname }}"
|
||||
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
|
||||
name: lircd
|
||||
state: restarted
|
||||
enabled: yes
|
||||
|
Reference in New Issue
Block a user