diff options
Diffstat (limited to 'roles')
| -rw-r--r-- | roles/automationhat/defaults/main.yaml | 12 | ||||
| -rw-r--r-- | roles/automationhat/tasks/main.yaml | 46 | ||||
| -rw-r--r-- | roles/hap-nodejs/tasks/main.yaml | 21 | ||||
| -rw-r--r-- | roles/rpi-base/defaults/main.yaml | 10 | ||||
| -rw-r--r-- | roles/rpi-base/tasks/main.yml | 2 |
5 files changed, 65 insertions, 26 deletions
diff --git a/roles/automationhat/defaults/main.yaml b/roles/automationhat/defaults/main.yaml new file mode 100644 index 0000000..1072549 --- /dev/null +++ b/roles/automationhat/defaults/main.yaml @@ -0,0 +1,12 @@ +--- + +automationhat_apt_packages: + - "python3" + - "raspi-gpio" + - "python3-rpi.gpio" + - "python3-smbus" + - "python3-sn3218" + +automationhat_modules: + - "i2c-bcm2708" + - "i2c-dev" diff --git a/roles/automationhat/tasks/main.yaml b/roles/automationhat/tasks/main.yaml index 405b450..7e9d6c6 100644 --- a/roles/automationhat/tasks/main.yaml +++ b/roles/automationhat/tasks/main.yaml @@ -1,13 +1,37 @@ --- -- name: download automationhat install script - get_url: - url: "https://get.pimoroni.com/automationhat" - dest: "/tmp/automationhat.sh" - mode: 0750 - -- name: install automationhat - shell: "/tmp/automationhat.sh" - args: - chdir: "/tmp" - executable: "/bin/bash" +# Based on https://get.pimoroni.com/automationhat script + +- name: install automationhat apt packages + become: yes + apt: name="{{item}}" + with_items: "{{automationhat_apt_packages}}" + +- name: configure i2c boot config + become: yes + lineinfile: + path: "/boot/config.txt" + line: "dtparam=i2c_arm=on" + insertafter: "^#dtparam=i2c_arm=on" + +- name: configure i2c kernel modules + become: yes + lineinfile: + path: "/etc/modules" + line: "{{item}}" + with_items: "{{automationhat_modules}}" + +- name: modprobe kernel modules + become: yes + modprobe: name="{{item}}" + with_items: "{{automationhat_modules}}" + +- name: dtparam i2c + become: yes + command: "dtparam i2c_arm=on" + changed_when: false + +- name: enable i2c with raspi-config + become: yes + command: "raspi-config nonint do_i2c 0" + changed_when: false diff --git a/roles/hap-nodejs/tasks/main.yaml b/roles/hap-nodejs/tasks/main.yaml index 048ac7f..cd3f71c 100644 --- a/roles/hap-nodejs/tasks/main.yaml +++ b/roles/hap-nodejs/tasks/main.yaml @@ -36,6 +36,7 @@ - name: clean up accessory examples become: yes file: path="{{hap_dest}}/accessories" state="absent" + changed_when: false - name: create accessories dir become: yes @@ -44,6 +45,17 @@ state: "directory" owner: "{{hap_user}}" group: "{{hap_user}}" + changed_when: false + +- name: install door accessory + become: yes + copy: + src: "../../../src/Door_accessory.js" + dest: "{{hap_dest}}/accessories/Door_accessory.js" + owner: "{{hap_user}}" + group: "{{hap_user}}" + notify: restart hap-nodejs service + changed_when: false - name: create python dir become: yes @@ -63,15 +75,6 @@ mode: "0755" notify: restart hap-nodejs service -- name: install door accessory - become: yes - copy: - src: "../../../src/Door_accessory.js" - dest: "{{hap_dest}}/accessories/Door_accessory.js" - owner: "{{hap_user}}" - group: "{{hap_user}}" - notify: restart hap-nodejs service - - name: build HAP-NodeJS become: yes become_user: "{{hap_user}}" diff --git a/roles/rpi-base/defaults/main.yaml b/roles/rpi-base/defaults/main.yaml index 40aef5a..0ec1e78 100644 --- a/roles/rpi-base/defaults/main.yaml +++ b/roles/rpi-base/defaults/main.yaml @@ -1,7 +1,7 @@ --- -ubuntu_base_apt_packages: - - emacs-nox - - python3 - - htop - - jq +rpi_base_apt_packages: + - "emacs-nox" + - "python3" + - "htop" + - "jq" diff --git a/roles/rpi-base/tasks/main.yml b/roles/rpi-base/tasks/main.yml index 1ff0ca8..41d7360 100644 --- a/roles/rpi-base/tasks/main.yml +++ b/roles/rpi-base/tasks/main.yml @@ -23,7 +23,7 @@ - name: install extra apt packages become: yes apt: name="{{item}}" - with_items: "{{ubuntu_base_apt_packages}}" + with_items: "{{rpi_base_apt_packages}}" - name: authorize admin ssh keys become: yes |
