Install homeassistant 2024.3.3
authorKristof Provost <kp@FreeBSD.org>
Wed, 17 Apr 2024 20:19:36 +0000 (22:19 +0200)
committerKristof Provost <kp@FreeBSD.org>
Wed, 17 Apr 2024 20:19:36 +0000 (22:19 +0200)
ansible/homeassistant.yaml
ansible/templates/homeassistant

index 5eddf35..cc14155 100644 (file)
@@ -16,7 +16,6 @@
         owner: "domotica"
         group: "domotica"
       become: true
-
     - name: install required python modules (pre-install)
       pip:
         name: "{{ item }}"
     - name: install defined version of Home Assistant
       pip:
         name: homeassistant
-        version: "2024.2.2"
+        version: "2024.3.3"
         virtualenv: "/home/domotica/ha/"
-      when: ha_version is defined
-      become: true
-    - name: install latest version of Home Assistant
-      pip:
-        name: homeassistant
-        extra_args: "--upgrade"
-        virtualenv: "/home/domotica/ha/"
-      when: ha_version is undefined
       become: true
     - name: install homeassistant startup script
       template:
         group: wheel
         mode: 0755
       become: true
+    - name: ensures {{ project_root }}/conf dir exists
+      file:
+        path: "/home/domotica/.homeassistant"
+        state: directory
+        owner: "domotica"
+        group: "domotica"
+        mode: 0755
+      become: true
+    - name: install homeassistant configuration
+      template:
+        src: configuration.yaml
+        dest: "/home/domotica/.homeassistant/configuration.yaml"
+        owner: "domotica"
+        group: "domotica"
+        mode: 0644
+      become: true
     - name: start home assistant
       community.general.sysrc:
         name: homeassistant_enable
index ca89697..933e59b 100644 (file)
@@ -11,9 +11,15 @@ name="homeassistant"
 rcvar=${name}_enable
 pidfile=/var/run/${name}.pid
 procname=/home/domotica/ha/bin/hass
+start_precmd="ha_prestart"
 
 command=/usr/sbin/daemon
-command_args=" -f -S -p ${pidfile} -u domotica ${procname} --ignore-os-check"
+command_args=" -f -S -p ${pidfile} -u domotica ${procname} --ignore-os-check --skip-pip"
+
+ha_prestart()
+{
+       chown -R domotica:domotica /home/domotica/ha
+}
 
 load_rc_config $name
 run_rc_command $1