summaryrefslogtreecommitdiff
path: root/roles/slim/raspbian/tasks/main.yml
blob: 39b0c66f9c1917c2a8e1c05ad47b26ae8146e027 (plain) (blame)
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
---
- name: remove legacy device-tree overlays for rpi3
  loop:
  - pi3-disable-wifi
  - pi3-disable-bt
  lineinfile:
    path: /boot/config.txt
    line: "dtoverlay={{ item }}"
    state: absent

- name: enable/disable bluetooh
  lineinfile:
    path: /boot/config.txt
    line: dtoverlay=disable-bt
    insertafter: '^\[all\]'
    state: "{{ raspbian_disable_bluetooth | ternary('present', 'absent') }}"

- name: enable/disable wifi
  lineinfile:
    path: /boot/config.txt
    line: dtoverlay=disable-wifi
    insertafter: '^\[all\]'
    state: "{{ raspbian_disable_wifi | ternary('present', 'absent') }}"

- name: enable/disable bluetooh
  lineinfile:
    path: /boot/config.txt
    line: dtoverlay=disable-bt
    insertafter: '^\[all\]'
    state: "{{ raspbian_disable_bluetooth | ternary('present', 'absent') }}"

- name: enable/disable audio
  lineinfile:
    path: /boot/config.txt
    regexp: '^dtparam=audio='
    line: "dtparam=audio={{ raspbian_disable_audio | ternary('off', 'on') }}"

- name: enable ssh-server
  systemd:
    name: ssh
    enabled: yes

- name: remove pi user
  user:
    name: pi
    state: absent
    remove: yes
    force: yes

- name: remove sudoers config for pi user
  file:
    path: /etc/sudoers.d/010_pi-nopasswd
    state: absent

- name: set hostname
  hostname:
    name: "{{ host_name }}"

- name: update hostname in /etc/hosts
  lineinfile:
    path: /etc/hosts
    backrefs: yes
    regexp: '^(127.0.1.1\s+)'
    line: '\g<1>{{ host_name }}'

- name: remove vscode sources.list and microsoft gpg key
  loop:
  - sources.list.d/vscode.list
  - trusted.gpg.d/microsoft.gpg
  file:
    path: "/etc/apt/{{ item }}"
    state: absent