From c21b7282b44fc186862656062bc4cf96d7d8007e Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Wed, 17 Apr 2024 22:19:36 +0200 Subject: [PATCH] Install homeassistant 2024.3.3 --- ansible/homeassistant.yaml | 27 +++++++++++++++++---------- ansible/templates/homeassistant | 8 +++++++- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ansible/homeassistant.yaml b/ansible/homeassistant.yaml index 5eddf35..cc14155 100644 --- a/ansible/homeassistant.yaml +++ b/ansible/homeassistant.yaml @@ -16,7 +16,6 @@ owner: "domotica" group: "domotica" become: true - - name: install required python modules (pre-install) pip: name: "{{ item }}" @@ -28,16 +27,8 @@ - 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: @@ -47,6 +38,22 @@ 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 diff --git a/ansible/templates/homeassistant b/ansible/templates/homeassistant index ca89697..933e59b 100644 --- a/ansible/templates/homeassistant +++ b/ansible/templates/homeassistant @@ -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 -- 2.51.0