xoxys.homeassistant_docker/tasks/install.yml
2019-04-27 13:52:50 +02:00

57 lines
1.5 KiB
YAML

---
- name: Prepare base folders
file:
path: "{{ item }}"
state: directory
owner: "{{ homeassistant_user }}"
group: "{{ homeassistant_user }}"
mode: 0750
loop:
- "{{ homeassistant_base_dir }}"
- "{{ homeassistant_conf_dir }}"
become: True
become_user: root
- block:
- name: Upgrade python dependencies
pip:
name: "{{ item }}"
virtualenv: "{{ homeassistant_base_dir }}/env"
virtualenv_command: /usr/bin/python3 -m venv
extra_args: --upgrade
loop:
- pip
- setuptools
- wheel
- name: Install with pip and virtualenv
pip:
name: homeassistant
version: "{{ homeassistant_version }}"
virtualenv: "{{ homeassistant_base_dir }}/env"
virtualenv_command: /usr/bin/python3 -m venv
notify: __homeassistant_restart
become: True
become_user: "{{ homeassistant_user }}"
- block:
- name: Copy systemd unit file
template:
src: "etc/systemd/system/homeassistant.service.j2"
dest: "/etc/systemd/system/homeassistant.service"
notify: __homeassistant_restart
- name: Open ports in iptables
iptables_raw:
name: "{{ item.name }}"
rules: "{{ item.rules }}"
state: "{{ item.state }}"
weight: "{{ item.weight | default(omit) }}"
table: "{{ item.table | default(omit) }}"
loop: "{{ homeassistant_open_ports }}"
loop_control:
label: "{{ item.name }}"
when: homeassistant_iptables_enabled
become: True
become_user: root