-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
97 lines (80 loc) · 2.23 KB
/
playbook.yml
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
-
name: Deploy a 5G Core
hosts: all
become: yes
tasks:
- name: Update all packages to their latest version
apt:
name: "*"
state: latest
- name: Install Dependency
apt:
name: software-properties-common
state: present
- name: Add open5gs latest repository from PPA
ansible.builtin.apt_repository:
repo: 'ppa:open5gs/latest'
- name: Again Update all packages to their latest version
apt:
name: "*"
state: latest
- name: Install Open5GS
apt:
name: open5gs
state: present
- name: Update AMF config
replace:
path: /etc/open5gs/amf.yaml
after: 'amf:\n\s+sbi:\n\s+\-\s+addr\:'
before: 'guami:'
regexp: '(\-\s+addr\:\s)+127\.0\.0\.5'
replace: '\g<1>{{ ansible_host }}'
backup: yes
- name: Update UPF config
replace:
path: /etc/open5gs/upf.yaml
after: 'upf:\n\s+pfcp:\n\s+\-\s+addr\:'
before: 'subnet:'
regexp: '(\-\s+addr\:\s)+127\.0\.0\.7'
replace: '\g<1>{{ ansible_host }}'
backup: yes
- name: Restart AMF Service
systemd:
name: open5gs-amfd
state: restarted
enabled: true
- name: Restart UPF Service
systemd:
name: open5gs-upfd
state: restarted
enabled: true
- name: NAT Port Forwarding
shell: |
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo systemctl stop ufw
sudo iptables -I FORWARD 1 -j ACCEPT
- name: Update all packages to their latest version
apt:
name: "*"
state: latest
- name: Install curl
apt:
name: curl
state: present
- name: curl package
shell: |
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
- name: Install nodejs
apt:
name: nodejs
state: present
- name: Clone code open5gs
shell: |
sudo rm -rf open5gs
git clone https://github.com/open5gs/open5gs.git
- name: Run Dashboard
shell: |
cd open5gs/webui
npm ci --no-optional && npm run build
npm run dev --host 0.0.0.0