Skip to content

Commit de14f6b

Browse files
committed
Add migration playbook
1 parent 0dc0b6d commit de14f6b

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

playbooks/migrate.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
- name: Run migrations
3+
hosts: all
4+
tasks:
5+
# Stop PM2 processes running in the default home (~/.pm2)
6+
# since v3 uses a per-collection home (~/.pm2-{collection_id})
7+
- name: Stop PM2 processes in default home
8+
ansible.builtin.shell: pm2 kill 2>/dev/null || true
9+
environment:
10+
PM2_HOME: /home/{{ ansible_user }}/.pm2
11+
12+
- name: Remove PM2 startup script
13+
ansible.builtin.shell: pm2 unstartup systemd 2>/dev/null || true
14+
become: true
15+
16+
- name: Remove default PM2 home
17+
ansible.builtin.file:
18+
path: /home/{{ ansible_user }}/.pm2
19+
state: absent
20+
21+
# Remove old nginx config (v2 used a single ota.conf,
22+
# v3 uses ota-global.conf and per-app ota-rate-limit-{app_id}.conf)
23+
- name: Remove old nginx config
24+
ansible.builtin.file:
25+
path: "{{ item }}"
26+
state: absent
27+
become: true
28+
loop:
29+
- /etc/nginx/conf.d/ota.conf
30+
- /etc/nginx/sites-enabled/ota
31+
- /etc/nginx/sites-available/ota
32+
33+
# See https://github.com/nodesource/distributions/issues/1908
34+
- name: Remove NodeSource repository on Debian >= 13
35+
when: ansible_distribution == 'Debian' and ansible_distribution_major_version | int >= 13
36+
become: true
37+
block:
38+
- name: Remove NodeSource APT repository
39+
ansible.builtin.file:
40+
path: /etc/apt/sources.list.d/nodesource.list
41+
state: absent
42+
43+
- name: Remove NodeSource GPG key
44+
ansible.builtin.file:
45+
path: /etc/apt/keyrings/nodesource.gpg
46+
state: absent
47+
48+
- name: Remove NodeSource Node.js package
49+
ansible.builtin.apt:
50+
name: nodejs
51+
state: absent
52+
purge: true

0 commit comments

Comments
 (0)