From 5f6b0c0e6e2ea3621cb0033b9f5498372c89db74 Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Fri, 19 Jan 2018 11:48:25 -0600 Subject: Initial public commit. --- roles/hap-nodejs/tasks/main.yaml | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 roles/hap-nodejs/tasks/main.yaml (limited to 'roles/hap-nodejs/tasks') diff --git a/roles/hap-nodejs/tasks/main.yaml b/roles/hap-nodejs/tasks/main.yaml new file mode 100644 index 0000000..3fac212 --- /dev/null +++ b/roles/hap-nodejs/tasks/main.yaml @@ -0,0 +1,45 @@ +--- + +- name: install homekit apt packages + become: yes + apt: name="{{item}}" + with_items: "{{hap_ubuntu_apt_packages}}" + +- name: download and unarchive HAP-NodeJS + unarchive: src="{{hap_src}}" dest="{{hap_home}}" remote_src="yes" creates="{{hap_dest}}" + +- name: install npm packages + npm: name="{{item}}" path="{{hap_dest}}" + with_items: "{{hap_npm_packages}}" + +- name: clean up accessory examples + file: path="{{hap_dest}}/accessories" state="absent" + +- name: create accessories dir + file: path="{{hap_dest}}/accessories" state="directory" + +- name: create python dir + file: path="{{hap_dest}}/python" state="directory" + +- name: install doord.py + copy: src="doord.py" dest="{{hap_dest}}/python/doord.py" + notify: restart hap-nodejs service + +- name: install door accessory + copy: src="Door_accessory.js" dest="{{hap_dest}}/accessories/Door_accessory.js" + notify: restart hap-nodejs service + +- name: build HAP-NodeJS + command: "npm install" + args: + chdir: "{{hap_dest}}" + changed_when: false + +- name: configure systemd service + become: yes + template: src="hap-nodejs.service.j2" dest="/lib/systemd/system/hap-nodejs.service" + notify: restart hap-nodejs service + +- name: ensure hap-nodejs is started + become: yes + systemd: name="hap-nodejs.service" enabled="yes" state="started" -- cgit v1.2.3