- Updated user addition tasks across multiple playbooks (mcp_switchboard, mcpo, neo4j, neo4j_mcp, openwebui, postgresql, rabbitmq, searxng, smtp4dev) to replace references to ansible_user and remote_user with keeper_user. - Modified PostgreSQL deployment to create directories and manage files under keeper_user's home. - Enhanced documentation to clarify account taxonomy and usage of keeper_user in playbooks. - Introduced new deployment for Agent S, including environment setup, desktop environment installation, XRDP configuration, and accessibility support. - Added staging playbook for preparing release tarballs from local repositories. - Created templates for XRDP configuration and environment activation scripts. - Removed obsolete sunwait documentation.
140 lines
3.6 KiB
YAML
140 lines
3.6 KiB
YAML
---
|
|
- name: Deploy Home Assistant to Dev Environment
|
|
hosts: ubuntu
|
|
vars:
|
|
ansible_common_remote_group: "{{hass_group}}"
|
|
allow_world_readable_tmpfiles: true
|
|
tasks:
|
|
- name: Check if host has hass service
|
|
ansible.builtin.set_fact:
|
|
has_hass_service: "{{ 'hass' in services | default([]) }}"
|
|
|
|
- name: Skip hosts without hass service
|
|
ansible.builtin.meta: end_host
|
|
when: not has_hass_service
|
|
|
|
- name: Create hass user
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: "{{hass_user}}"
|
|
comment: "{{hass_user}}"
|
|
system: true
|
|
create_home: false
|
|
|
|
- name: Add group hass to keeper_user
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: "{{keeper_user}}"
|
|
groups: "{{hass_group}}"
|
|
append: true
|
|
|
|
- name: Create required directories
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{item.path}}"
|
|
owner: "{{hass_user}}"
|
|
group: "{{hass_group}}"
|
|
state: directory
|
|
mode: '750'
|
|
loop:
|
|
- path: "{{hass_directory}}"
|
|
- path: "{{hass_media_directory}}"
|
|
|
|
- name: Add Deadsnakes APT repository
|
|
become: true
|
|
ansible.builtin.apt_repository:
|
|
repo: ppa:deadsnakes/ppa
|
|
|
|
- name: Install Python 3.13 and build dependencies
|
|
become: true
|
|
ansible.builtin.apt:
|
|
name:
|
|
- python3.13-dev
|
|
- python3.13-venv
|
|
- build-essential
|
|
- libffi-dev
|
|
- libssl-dev
|
|
state: present
|
|
update_cache: true
|
|
|
|
- name: Create virtual environment
|
|
become: true
|
|
become_user: "{{hass_user}}"
|
|
ansible.builtin.command:
|
|
cmd: python3.13 -m venv {{hass_directory}}/env
|
|
args:
|
|
creates: "{{hass_directory}}/env/bin/activate"
|
|
|
|
- name: Template configuration files
|
|
become: true
|
|
ansible.builtin.template:
|
|
src: "{{item.src}}"
|
|
dest: "{{hass_directory}}/{{item.dest}}"
|
|
owner: "{{hass_user}}"
|
|
group: "{{hass_group}}"
|
|
mode: '550'
|
|
loop:
|
|
- src: "configuration.yaml.j2"
|
|
dest: "configuration.yaml"
|
|
- src: "requirements.txt.j2"
|
|
dest: "requirements.txt"
|
|
notify: restart hass
|
|
|
|
- name: Create systemd service file
|
|
become: true
|
|
ansible.builtin.template:
|
|
src: hass.service.j2
|
|
dest: /etc/systemd/system/hass.service
|
|
mode: '644'
|
|
notify: restart hass
|
|
|
|
- name: Install Python packages from requirements
|
|
become: true
|
|
become_user: "{{hass_user}}"
|
|
ansible.builtin.pip:
|
|
requirements: "{{hass_directory}}/requirements.txt"
|
|
virtualenv: "{{hass_directory}}/env"
|
|
virtualenv_python: python3.13
|
|
vars:
|
|
ansible_common_remote_group: "{{hass_group}}"
|
|
allow_world_readable_tmpfiles: true
|
|
notify: restart hass
|
|
|
|
- name: Reset SSH connection to apply group changes
|
|
meta: reset_connection
|
|
|
|
- name: Enable and start Home Assistant service
|
|
become: true
|
|
ansible.builtin.systemd:
|
|
name: hass
|
|
enabled: true
|
|
state: started
|
|
daemon_reload: true
|
|
|
|
post_tasks:
|
|
- name: Wait for Home Assistant to initialize
|
|
ansible.builtin.pause:
|
|
seconds: 30
|
|
prompt: "Waiting for Home Assistant to initialize..."
|
|
|
|
- name: Check if Home Assistant is running
|
|
ansible.builtin.uri:
|
|
url: http://localhost:{{hass_port}}/
|
|
method: GET
|
|
status_code: 200
|
|
timeout: 10
|
|
register: hass_status
|
|
ignore_errors: true
|
|
|
|
- name: Show Home Assistant status
|
|
ansible.builtin.debug:
|
|
msg: "Home Assistant is {{ 'running' if hass_status.status == 200 else 'not running properly' }}"
|
|
|
|
handlers:
|
|
- name: restart hass
|
|
become: true
|
|
ansible.builtin.systemd:
|
|
name: hass
|
|
state: restarted
|
|
daemon_reload: true
|