fix headscale and lnbits
This commit is contained in:
parent
0bafa6ba2c
commit
eb047a29f3
3 changed files with 137 additions and 26 deletions
|
|
@ -19,28 +19,91 @@
|
|||
- name: Install required system packages
|
||||
apt:
|
||||
name:
|
||||
- python3.11
|
||||
- python3.11-venv
|
||||
- python3
|
||||
- python3-pip
|
||||
- git
|
||||
- curl
|
||||
- build-essential
|
||||
- pkg-config
|
||||
- libffi-dev
|
||||
- libssl-dev
|
||||
- zlib1g-dev
|
||||
- libbz2-dev
|
||||
- libreadline-dev
|
||||
- libsqlite3-dev
|
||||
- libncursesw5-dev
|
||||
- xz-utils
|
||||
- tk-dev
|
||||
- libxml2-dev
|
||||
- libxmlsec1-dev
|
||||
- liblzma-dev
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Install Poetry
|
||||
- name: Install pyenv
|
||||
shell: |
|
||||
curl -sSL https://install.python-poetry.org | python3 -
|
||||
curl https://pyenv.run | bash
|
||||
args:
|
||||
creates: "{{ lookup('env', 'HOME') }}/.local/bin/poetry"
|
||||
creates: "/home/{{ ansible_user }}/.pyenv"
|
||||
become: yes
|
||||
become_user: "{{ ansible_user }}"
|
||||
environment:
|
||||
HOME: "/home/{{ ansible_user }}"
|
||||
|
||||
- name: Add pyenv to PATH
|
||||
lineinfile:
|
||||
path: "/home/{{ ansible_user }}/.bashrc"
|
||||
line: 'export PYENV_ROOT="$HOME/.pyenv"'
|
||||
state: present
|
||||
become: yes
|
||||
become_user: "{{ ansible_user }}"
|
||||
|
||||
- name: Add pyenv init to bashrc
|
||||
lineinfile:
|
||||
path: "/home/{{ ansible_user }}/.bashrc"
|
||||
line: 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"'
|
||||
state: present
|
||||
become: yes
|
||||
become_user: "{{ ansible_user }}"
|
||||
|
||||
- name: Add pyenv init to bashrc (second line)
|
||||
lineinfile:
|
||||
path: "/home/{{ ansible_user }}/.bashrc"
|
||||
line: 'eval "$(pyenv init -)"'
|
||||
state: present
|
||||
become: yes
|
||||
become_user: "{{ ansible_user }}"
|
||||
|
||||
- name: Install Python 3.12 via pyenv
|
||||
shell: |
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
eval "$(pyenv init -)"
|
||||
pyenv install -s 3.12.7
|
||||
pyenv global 3.12.7
|
||||
args:
|
||||
creates: "/home/{{ ansible_user }}/.pyenv/versions/3.12.7/bin/python3.12"
|
||||
become: yes
|
||||
become_user: "{{ ansible_user }}"
|
||||
environment:
|
||||
HOME: "/home/{{ ansible_user }}"
|
||||
|
||||
- name: Install Poetry
|
||||
shell: |
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/versions/3.12.7/bin:$PATH"
|
||||
eval "$(pyenv init -)"
|
||||
curl -sSL https://install.python-poetry.org | python3 -
|
||||
args:
|
||||
creates: "/home/{{ ansible_user }}/.local/bin/poetry"
|
||||
become: yes
|
||||
become_user: "{{ ansible_user }}"
|
||||
environment:
|
||||
HOME: "/home/{{ ansible_user }}"
|
||||
|
||||
- name: Add Poetry to PATH
|
||||
lineinfile:
|
||||
path: "{{ lookup('env', 'HOME') }}/.bashrc"
|
||||
path: "/home/{{ ansible_user }}/.bashrc"
|
||||
line: 'export PATH="$HOME/.local/bin:$PATH"'
|
||||
state: present
|
||||
become: yes
|
||||
|
|
@ -60,10 +123,27 @@
|
|||
group: "{{ ansible_user }}"
|
||||
recurse: yes
|
||||
|
||||
- name: Install LNBits dependencies
|
||||
command: $HOME/.local/bin/poetry install --only main
|
||||
- name: Configure Poetry to use Python 3.12
|
||||
command: /home/{{ ansible_user }}/.local/bin/poetry env use /home/{{ ansible_user }}/.pyenv/versions/3.12.7/bin/python3.12
|
||||
args:
|
||||
chdir: "{{ lnbits_dir }}/lnbits"
|
||||
become: yes
|
||||
become_user: "{{ ansible_user }}"
|
||||
environment:
|
||||
HOME: "/home/{{ ansible_user }}"
|
||||
PATH: "/home/{{ ansible_user }}/.local/bin:/home/{{ ansible_user }}/.pyenv/versions/3.12.7/bin:/home/{{ ansible_user }}/.pyenv/bin:{{ ansible_env.PATH }}"
|
||||
PYENV_ROOT: "/home/{{ ansible_user }}/.pyenv"
|
||||
|
||||
- name: Install LNBits dependencies
|
||||
command: /home/{{ ansible_user }}/.local/bin/poetry install --only main
|
||||
args:
|
||||
chdir: "{{ lnbits_dir }}/lnbits"
|
||||
become: yes
|
||||
become_user: "{{ ansible_user }}"
|
||||
environment:
|
||||
HOME: "/home/{{ ansible_user }}"
|
||||
PATH: "/home/{{ ansible_user }}/.local/bin:/home/{{ ansible_user }}/.pyenv/versions/3.12.7/bin:/home/{{ ansible_user }}/.pyenv/bin:{{ ansible_env.PATH }}"
|
||||
PYENV_ROOT: "/home/{{ ansible_user }}/.pyenv"
|
||||
|
||||
- name: Copy .env.example to .env
|
||||
copy:
|
||||
|
|
@ -111,6 +191,8 @@
|
|||
Restart=always
|
||||
RestartSec=30
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
Environment="PATH=/home/{{ ansible_user }}/.local/bin:/home/{{ ansible_user }}/.pyenv/versions/3.12.7/bin:/home/{{ ansible_user }}/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
Environment="PYENV_ROOT=/home/{{ ansible_user }}/.pyenv"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -143,6 +225,8 @@
|
|||
insertafter: EOF
|
||||
state: present
|
||||
backup: yes
|
||||
create: yes
|
||||
mode: '0644'
|
||||
|
||||
- name: Create Caddy reverse proxy configuration for lnbits
|
||||
copy:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue