forked from UBC-Thunderbots/Software
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_pi.yml
More file actions
142 lines (124 loc) · 4.19 KB
/
Copy pathsetup_pi.yml
File metadata and controls
142 lines (124 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
---
- name: Setting up the Raspberry Pi
hosts: THUNDERBOTS_HOSTS
tasks:
- name: Copy SSH public key
ansible.builtin.import_tasks: ../tasks/copy_ssh_key.yml
- name: Check internet connection
tags: dependencies
ansible.builtin.import_tasks:
file: ../tasks/check_internet.yml
- name: Time sync by enabling ntp
tags: configure_pi
ansible.builtin.import_tasks:
file: ../tasks/enable_ntp.yml
- name: Enable passwordless sudo for rsync
tags:
- dependencies
- configure_pi
ansible.builtin.import_tasks:
file: ../tasks/enable_password_less_sudo_for_rsync.yml
- name: Setup Robot Software dependencies
tags:
- dependencies
ansible.builtin.import_tasks:
file: ../tasks/setup_robot_software_deps.yml
- name: Setup systemd
tags:
- dependencies
- configure_pi
ansible.builtin.import_tasks:
file: ../tasks/setup_systemd.yml
- name: Add user robot to dialout
tags:
- configure_pi
- dependencies
ansible.builtin.import_tasks:
file: ../tasks/add_user_to_dialout.yml
- name: Disable pcie_aspm
tags:
- configure_pi
block:
- name: Backup cmdline.txt
become: true
become_method: ansible.builtin.sudo
ansible.builtin.copy:
src: /boot/firmware/cmdline.txt
dest: /boot/firmware/cmdline.txt.bak
remote_src: true
mode: "0644"
- name: Check if pcie_aspm is disabled
ansible.builtin.command: 'grep -q "pcie_aspm=off" /boot/firmware/cmdline.txt'
ignore_errors: true
register: pcie_aspm_disabled
changed_when: false
- name: Disable pcie_aspm
when: pcie_aspm_disabled.rc != 0
become: true
become_method: ansible.builtin.sudo
ansible.builtin.lineinfile:
path: /boot/firmware/cmdline.txt
regexp: ^(\s*console.*)$
backrefs: true
line: "\\1 pcie_aspm=off"
state: present
- name: Set up SPI and Wifi drivers
tags: configure_pi
block:
- name: Sync setup files
ansible.posix.synchronize:
src: ../../linux_configs/pi/setup.zip
dest: ~/
copy_links: true
- name: Unzip setup files
ansible.builtin.unarchive:
src: ~/setup.zip
dest: ~/
remote_src: true
- name: Set up Wifi drivers
become: true
become_method: ansible.builtin.sudo
ansible.builtin.command:
cmd: "mv /home/{{ ansible_user }}/iwlwifi* /lib/firmware/"
creates: /lib/firmware/iwlwifi*.ucode
- name: Set up systemd Wifi interface name rule
ansible.builtin.import_tasks:
file: ../tasks/setup_wifi_interface.yml
- name: Set up SPI overlay
become: true
become_method: ansible.builtin.sudo
ansible.builtin.command:
cmd: "mv /home/{{ ansible_user }}/spi0-5cs.dtbo /boot/firmware/overlays/"
creates: /boot/firmware/overlays/spi0-5cs.dtbo
- name: Update config.txt to select custom SPI overlay
become: true
become_method: ansible.builtin.sudo
ansible.builtin.copy:
src: ../../linux_configs/pi/config.txt
dest: /boot/firmware/
mode: "0444"
- name: Update udev configs to map connected devices
become: true
become_method: ansible.builtin.sudo
ansible.builtin.copy:
src: ../../linux_configs/pi/10-local.rules
dest: /etc/udev/rules.d/
mode: "0444"
- name: Change hostname
tags: update_hostname
ansible.builtin.import_tasks:
file: ../tasks/set_user_hostname.yml
- name: Reboot
tags:
- dependencies
- configure_pi
- update_hostname
ansible.builtin.import_tasks:
file: ../tasks/reboot.yml
- name: Success
tags:
- dependencies
- configure_pi
- update_hostname
ansible.builtin.debug:
msg: "Raspberry Pi setup complete for {{ inventory_hostname }}"