-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraspberry-sw-prereqs.yaml
More file actions
90 lines (90 loc) · 2.66 KB
/
raspberry-sw-prereqs.yaml
File metadata and controls
90 lines (90 loc) · 2.66 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
--- # Ansible Playbook to configure a set of Raspberry PIs in a consistent and repeatable way
# ===== OpenJDK installation and configuration for "appserver" Raspberry PI boxes
- hosts: appserver
remote_user: "{{ user }}"
become: yes
vars:
src_dir: "{{ playbook_dir }}"
mode: u=rwx
vars_files:
- "{{ src_dir }}/conf/config.yml"
tasks:
###############################################
##### Update package manager repositories #####
###############################################
- name: Update package manager repositories cache
apt:
update_cache: yes
######################################
##### Upgrade installed packages #####
######################################
- name: Upgrade installed packages
apt:
upgrade: dist
########################
##### Java Section #####
########################
- name: Install OpenJDK
apt:
name: default-jdk
state: present
# ===== NodeJs installation and configuration for "maps_service" Raspberry PI boxes
- hosts: maps_service
remote_user: "{{ user }}"
become: yes
vars:
src_dir: "{{ playbook_dir }}"
mode: u=rwx
nodejs_version: "20.x" # You can change this to the desired NodeJS version
vars_files:
- "{{ src_dir }}/conf/config.yml"
tasks:
- name: Update apt cache
apt:
update_cache: yes
changed_when: false
- name: Install required packages
apt:
name:
- apt-transport-https
- curl
- gnupg
state: present
- name: Add NodeJS repository key
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
- name: Add NodeJS repository
apt_repository:
repo: "deb https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main"
filename: nodesource
update_cache: yes
- name: Install NodeJS
apt:
name:
- nodejs
state: present
- name: Verify NodeJS installation
command: node --version
register: node_version
changed_when: false
- name: Display NodeJS version
debug:
msg: "Installed NodeJS version: {{ node_version.stdout }}"
- name: Install npm
apt:
name: npm
state: present
- name: Verify npm installation
command: npm --version
register: npm_version
changed_when: false
- name: Display npm version
debug:
msg: "Installed npm version: {{ npm_version.stdout }}"
- name: Install pm2 process manager for Node.js
npm:
name: pm2
global: yes
production: yes
state: present