roles/automationhat/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sun, 02 Aug 2020 15:00:41 -0500
changeset 27 df47a99d5bfc
parent 25 bc6c646f1814
permissions -rw-r--r--
Added canonical repo path.
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
25
bc6c646f1814 Updated to latest ansible syntax for lists.
Luke Hoersten <luke@hoersten.org>
parents: 9
diff changeset
     7
  apt: name="{{automationhat_apt_packages}}"
9
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
     8
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
     9
- name: configure i2c boot config
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    10
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    11
  lineinfile:
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    12
    path: "/boot/config.txt"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    13
    line: "dtparam=i2c_arm=on"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    14
    insertafter: "^#dtparam=i2c_arm=on"
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
9
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    16
- name: configure i2c kernel modules
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    17
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    18
  lineinfile:
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    19
    path: "/etc/modules"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    20
    line: "{{item}}"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    21
  with_items: "{{automationhat_modules}}"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    22
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    23
- name: modprobe kernel modules
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    24
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    25
  modprobe: name="{{item}}"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    26
  with_items: "{{automationhat_modules}}"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    27
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    28
- name: dtparam i2c
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    29
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    30
  command: "dtparam i2c_arm=on"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    31
  changed_when: false
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    32
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    33
- name: enable i2c with raspi-config
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    34
  become: yes
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    35
  command: "raspi-config nonint do_i2c 0"
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    36
  changed_when: false