71 lines
1.6 KiB
YAML
71 lines
1.6 KiB
YAML
---
|
|
- name: Create group
|
|
ansible.builtin.group:
|
|
name: ha
|
|
|
|
- name: Create user
|
|
ansible.builtin.user:
|
|
name: ha
|
|
comment: Podman HomeAssistant
|
|
group: ha
|
|
shell: /sbin/nologin
|
|
|
|
- name: Fix SELinux contexts from config directory
|
|
community.general.sefcontext:
|
|
path: /export/homeassistant(/.*)?
|
|
setype: container_file_t
|
|
when: ansible_selinux_python_present
|
|
|
|
- name: Create config directory
|
|
ansible.builtin.file:
|
|
path: /export/homeassistant
|
|
state: directory
|
|
mode: 0700
|
|
owner: ha
|
|
group: ha
|
|
setype: _default
|
|
|
|
- name: Link config directory
|
|
ansible.builtin.file:
|
|
dest: /srv/homeassistant
|
|
src: /export/homeassistant
|
|
state: link
|
|
owner: root
|
|
group: "{{ ansible_wheel }}"
|
|
follow: false
|
|
|
|
- name: Copy authentication command
|
|
ansible.builtin.copy:
|
|
dest: /srv/homeassistant/auth-command.sh
|
|
src: auth-command.sh
|
|
mode: 0755
|
|
owner: root
|
|
group: "{{ ansible_wheel }}"
|
|
setype: _default
|
|
|
|
- name: Create service file
|
|
ansible.builtin.template:
|
|
dest: /etc/systemd/system/homeassistant-container.service
|
|
src: homeassistant-container.service.j2
|
|
mode: 0644
|
|
owner: root
|
|
group: "{{ ansible_wheel }}"
|
|
notify: Restart homeassistant
|
|
|
|
- name: Enable service
|
|
ansible.builtin.service:
|
|
name: homeassistant-container
|
|
state: started
|
|
enabled: true
|
|
|
|
- name: Copy nginx config
|
|
ansible.builtin.copy:
|
|
dest: "/etc/nginx/conf.d/{{ inventory_hostname }}/homeassistant.conf"
|
|
content: |
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8001;
|
|
}
|
|
mode: 0644
|
|
owner: root
|
|
group: "{{ ansible_wheel }}"
|
|
notify: Restart nginx
|