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
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