add service state variables
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Robert Kaussow 2019-08-08 22:52:37 +02:00
parent 98d6dd8fe1
commit d79aef473f
5 changed files with 18 additions and 65 deletions

View File

@ -7,6 +7,9 @@ zigbee2mqtt_secondary_groups:
- tty
- dialout
zigbee2mqtt_service_state: started
zigbee2mqtt_service_restart_state: restarted
zigbee2mqtt_base_dir: /opt/zigbee2mqtt
zigbee2mqtt_log_dir: "{{ zigbee2mqtt_base_dir }}/log"
zigbee2mqtt_log_level: info

View File

@ -1,7 +1,7 @@
---
- name: Restart zigbee2mqtt service
systemd:
state: restarted
state: "{{ zigbee2mqtt_service_restart_state }}"
daemon_reload: yes
name: zigbee2mqtt
listen: __zigbee2mqtt_restart

View File

@ -5,6 +5,8 @@
mosquitto_packages_extra:
- epel-release
mosquitto_bind_address: "127.0.0.1"
zigbee2mqtt_service_state: stopped
zigbee2mqtt_service_restart_state: stopped
roles:
- role: xoxys.mosquitto

View File

@ -14,35 +14,6 @@
become_user: root
- block:
# - name: Check data dir
# stat:
# path: "{{ zigbee2mqtt_base_dir }}/data"
# register: __zigbee_datadir
# - name: Backup data directory
# synchronize:
# src: "{{ zigbee2mqtt_base_dir }}/data/"
# dest: "/tmp/zigbee_data"
# recursive: yes
# delegate_to: "{{ inventory_hostname }}"
# when: __zigbee_datadir.stat.exists
# - name: Setup zigbee2mqtt
# git:
# repo: "https://github.com/Koenkk/zigbee2mqtt"
# dest: "{{ zigbee2mqtt_base_dir }}/bin"
# version: "{{ zigbee2mqtt_version }}"
# force: yes
# register: __zigbee2mqtt_install
# - name: Restore data directory
# synchronize:
# src: "/tmp/zigbee_data/"
# dest: "{{ zigbee2mqtt_base_dir }}/data"
# recursive: yes
# delegate_to: "{{ inventory_hostname }}"
# when: __zigbee_datadir.stat.exists
- name: Download release 'v{{ zigbee2mqtt_version }}'
unarchive:
src: "https://github.com/Koenkk/zigbee2mqtt/archive/{{ zigbee2mqtt_version }}.tar.gz"
@ -52,8 +23,6 @@
extra_opts:
- --strip-components=1
register: __zigbee2mqtt_install
- name: Delete existing node_modules folder
file:
path: "{{ zigbee2mqtt_base_dir }}/node_modules"
@ -69,21 +38,6 @@
become: True
become_user: "{{ zigbee2mqtt_user }}"
- block:
# - name: Cleanup base directory
# file:
# path: "{{ zigbee2mqtt_base_dir }}/{{ item }}"
# state: absent
# loop:
# - docker
# - docs
# - images
# - LICENSE
# - README.md
# - scripts
# - test
# - update.sh
- name: Deploy configuration file
template:
src: "zigbee2mqtt/data/configuration.yaml.j2"

View File

@ -1,15 +1,9 @@
---
- block:
- name: Ensure zigbee2mqtt service is up and running
systemd:
state: started
state: "{{ zigbee2mqtt_service_state }}"
daemon_reload: yes
enabled: yes
name: zigbee2mqtt
# - name: Delete backup data directory
# file:
# path: "/tmp/zigbee_data"
# state: absent
become: True
become_user: root