-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathvps-pbgui-python312.yml
More file actions
118 lines (101 loc) · 3.18 KB
/
vps-pbgui-python312.yml
File metadata and controls
118 lines (101 loc) · 3.18 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
---
# Recreate PBGui venv with Python 3.12 on a VPS (in-place, not parallel)
# Steps:
# 1. Stop PBRun + PBRemote + PBCoinData
# 2. Install python3.12-venv
# 3. Remove old venv_pbgui
# 4. Create new python3.12 venv for PBGui + install requirements (upgrade pip)
# 5. Start PBRun + PBRemote + PBCoinData
- hosts: "{{ hostname }}"
gather_facts: true
vars:
ansible_become_password: "{{ user_pw }}"
user: "{{ user }}"
tasks:
- name: display facts
debug:
var: ansible_facts
tags: debug,never
- name: get install_dir
set_fact:
install_dir: "{{ ansible_facts['env']['HOME'] }}/software"
- name: Ensure PBGui repo exists
stat:
path: "{{ install_dir }}/pbgui"
register: pbgui_repo
- name: Fail if PBGui repo is missing
fail:
msg: "PBGui repo not found at {{ install_dir }}/pbgui (run VPS setup/update first)."
when: not pbgui_repo.stat.exists
- name: Get current PBGui branch
command: git rev-parse --abbrev-ref HEAD
args:
chdir: "{{ install_dir }}/pbgui"
register: current_branch
changed_when: false
- name: Update PBGui repository (keep current branch)
git:
repo: https://github.com/msei99/pbgui.git
dest: "{{ install_dir }}/pbgui"
version: "{{ (current_branch.stdout != 'HEAD') | ternary(current_branch.stdout, omit) }}"
update: yes
force: yes
register: pbgui_repo_update
- name: print pbgui_repo_update
debug:
var: pbgui_repo_update
tags: debug,never
- name: Stop PBRun + PBRemote + PBCoinData
shell: |
source "{{ install_dir }}/venv_pbgui/bin/activate"
python "{{ install_dir }}/pbgui/starter.py" -k PBRun PBRemote PBCoinData
args:
executable: /bin/bash
chdir: "{{ install_dir }}/pbgui"
ignore_errors: yes
- name: Install python3.12-venv
apt:
pkg:
- python3.12-venv
update_cache: yes
clean: yes
become: yes
- name: Remove python3.10-venv
apt:
pkg:
- python3.10-venv
state: absent
autoremove: yes
clean: yes
become: yes
- name: Remove old PBGui venv
file:
path: "{{ install_dir }}/venv_pbgui"
state: absent
become: yes
- name: create python3.12 venv for PBGui
pip:
virtualenv_command: python3.12 -m venv
virtualenv: "{{ install_dir }}/venv_pbgui"
requirements: "{{ install_dir }}/pbgui/requirements_vps.txt"
extra_args: --no-cache-dir --upgrade pip
environment:
PIP_NO_CACHE_DIR: "1"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
- name: remove pip cache directory
file:
path: "{{ ansible_facts['env']['HOME'] }}/.cache/pip"
state: absent
- name: clean apt package cache
apt:
autoremove: yes
autoclean: yes
clean: yes
become: yes
- name: Start PBRun + PBRemote + PBCoinData
shell: |
source "{{ install_dir }}/venv_pbgui/bin/activate"
python "{{ install_dir }}/pbgui/starter.py" -s PBRun PBRemote PBCoinData
args:
executable: /bin/bash
chdir: "{{ install_dir }}/pbgui"