xoxys.homeassistant_docker/tasks/install.yml

69 lines
1.9 KiB
YAML
Raw Normal View History

2019-04-27 11:52:50 +00:00
---
- 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 }}"
2019-04-27 12:21:37 +00:00
virtualenv: "{{ homeassistant_base_dir }}/venv"
2019-04-27 11:52:50 +00:00
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 }}"
2019-04-27 12:21:37 +00:00
virtualenv: "{{ homeassistant_base_dir }}/venv"
2019-04-27 11:52:50 +00:00
virtualenv_command: /usr/bin/python3 -m venv
notify: __homeassistant_restart
become: True
become_user: "{{ homeassistant_user }}"
- block:
2019-05-04 15:25:31 +00:00
- name: Patch /boot/cmdline
copy:
content: "{{ homeassistant_cmdline_content }}"
dest: /boot/cmdline.txt
when: homeassistant_cmdline_content is defined
- name: Exclude serial devices from ModemManager
template:
src: "etc/udev/rules.d/99-mm-disable.rules.j2"
dest: "/etc/udev/rules.d/99-mm-disable.rules"
when: homeassistant_exclude_modemmanager
2019-04-27 11:52:50 +00:00
- 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