ansible-infra/playbooks/roles/esphome/tasks/main.yaml

42 lines
1 KiB
YAML
Raw Normal View History

2022-12-04 20:11:39 +01:00
- name: Ensure acl is installed
become: true
2022-12-04 20:11:39 +01:00
ansible.builtin.apt:
name: acl
- name: Ensure pip is installed
become: true
2022-12-04 20:11:39 +01:00
ansible.builtin.apt:
name: python3-pip
- name: Ensure esphome user exists
become: true
2022-12-04 20:11:39 +01:00
ansible.builtin.user:
name: esphome
shell: /bin/bash
2022-12-04 20:11:39 +01:00
- name: Ensure esphome dependencies are installed
become: true
2022-12-04 20:11:39 +01:00
become_user: esphome
ansible.builtin.pip:
name: tornado
extra_args: --user
2023-04-15 18:22:37 +02:00
- name: Ensure esphome is installed
become: true
2022-12-04 20:11:39 +01:00
become_user: esphome
ansible.builtin.pip:
name: "esphome=={{ esphome__version }}"
extra_args: --user
notify: Restart esphome
- name: Ensure esphome systemd service file is deployed
become: true
2022-12-04 20:11:39 +01:00
ansible.builtin.copy:
src: esphome.service
dest: /etc/systemd/system/esphome.service
mode: "644"
2022-12-04 20:11:39 +01:00
owner: root
group: root
notify: Restart esphome
- name: Ensure esphome service is enabled and started
become: true
2022-12-04 20:11:39 +01:00
ansible.builtin.systemd:
service: esphome.service
enabled: true
state: started