Move python3 to hap-nodejs role.
authorLuke Hoersten <luke@hoersten.org>
Thu, 01 Mar 2018 17:04:29 -0600
changeset 17 69a7d69de562
parent 16 23b704e271bb
child 18 3044f32e7f74
Move python3 to hap-nodejs role.
roles/hap-nodejs/defaults/main.yaml
roles/hap-nodejs/tasks/main.yaml
roles/rpi-base/defaults/main.yaml
--- a/roles/hap-nodejs/defaults/main.yaml	Thu Feb 22 22:09:20 2018 -0600
+++ b/roles/hap-nodejs/defaults/main.yaml	Thu Mar 01 17:04:29 2018 -0600
@@ -1,7 +1,23 @@
 ---
 
+hap_apt_packages:
+    - "python3"
+    - "libavahi-compat-libdnssd-dev"
+    - "nodejs-legacy"
+    - "npm"
+
 hap_user: "hap-nodejs"
 hap_restart_sec: 10
 hap_dir: "/home/{{hap_user}}"
 hap_src: "https://github.com/KhaosT/HAP-NodeJS/archive/master.zip"
 hap_dest: "{{hap_dir}}/HAP-NodeJS-master"
+
+hap_example_accessories:
+  - "AirConditioner_accessory.js"
+  - "Fan_accessory.js"
+  - "GarageDoorOpener_accessory.js"
+  - "Light_accessory.js"
+  - "Lock_accessory.js"
+  - "MotionSensor_accessory.js"
+  - "Outlet_accessory.js"
+  - "TemperatureSensor_accessory.js"
--- a/roles/hap-nodejs/tasks/main.yaml	Thu Feb 22 22:09:20 2018 -0600
+++ b/roles/hap-nodejs/tasks/main.yaml	Thu Mar 01 17:04:29 2018 -0600
@@ -14,10 +14,7 @@
 - name: install homekit apt packages
   become: yes
   apt: name="{{item}}"
-  with_items:
-    - "libavahi-compat-libdnssd-dev"
-    - "nodejs-legacy"
-    - "npm"
+  with_items: "{{hap_apt_packages}}"
   notify: restart hap-nodejs service
 
 - name: download and unarchive HAP-NodeJS
@@ -37,19 +34,10 @@
   npm: name="python-shell" global="yes"
   notify: restart hap-nodejs service
 
-- name: clean up accessory examples
-  become: yes
-  file: path="{{hap_dest}}/accessories" state="absent"
-  changed_when: false
-
-- name: create accessories dir
+- name: remove example accessories
   become: yes
-  file:
-    path: "{{hap_dest}}/accessories"
-    state: "directory"
-    owner: "{{hap_user}}"
-    group: "{{hap_user}}"
-  changed_when: false
+  file: path="{{hap_dest}}/accessories/{{item}}" state="absent"
+  with_items: "{{hap_example_accessories}}"
 
 - name: install door accessory
   become: yes
@@ -59,7 +47,6 @@
     owner: "{{hap_user}}"
     group: "{{hap_user}}"
   notify: restart hap-nodejs service
-  changed_when: false
 
 - name: create python dir
   become: yes
--- a/roles/rpi-base/defaults/main.yaml	Thu Feb 22 22:09:20 2018 -0600
+++ b/roles/rpi-base/defaults/main.yaml	Thu Mar 01 17:04:29 2018 -0600
@@ -2,6 +2,5 @@
 
 rpi_base_apt_packages:
   - "emacs-nox"
-  - "python3"
   - "htop"
   - "jq"