roles/automationhat/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Tue, 30 Jan 2018 08:41:33 -0600
changeset 9 511e97bd5566
parent 0 30d8bcb1ebb4
child 25 bc6c646f1814
permissions -rw-r--r--
Created custom automationhat role.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
9
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
     3
# Based on https://get.pimoroni.com/automationhat script
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
     4
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
     5
- name: install automationhat apt packages
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
     6
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
     7
  apt: name="{{item}}"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
     8
  with_items: "{{automationhat_apt_packages}}"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
     9
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    10
- name: configure i2c boot config
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    11
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    12
  lineinfile:
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    13
    path: "/boot/config.txt"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    14
    line: "dtparam=i2c_arm=on"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    15
    insertafter: "^#dtparam=i2c_arm=on"
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
9
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    17
- name: configure i2c kernel modules
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    18
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    19
  lineinfile:
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    20
    path: "/etc/modules"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    21
    line: "{{item}}"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    22
  with_items: "{{automationhat_modules}}"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    23
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    24
- name: modprobe kernel modules
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    25
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    26
  modprobe: name="{{item}}"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    27
  with_items: "{{automationhat_modules}}"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    28
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    29
- name: dtparam i2c
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    30
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    31
  command: "dtparam i2c_arm=on"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    32
  changed_when: false
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    33
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    34
- name: enable i2c with raspi-config
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    35
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    36
  command: "raspi-config nonint do_i2c 0"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    37
  changed_when: false