feat(common): add optional Privoxy SOCKS5-to-HTTP setup via include_tasks

This commit is contained in:
Haitao Pan 2025-04-13 15:58:37 +08:00
parent 56c17b46d7
commit 381e4ea47d
3 changed files with 32 additions and 0 deletions

View File

@ -17,6 +17,11 @@ journald_log_rotation: # 启用 journald 日志管理
system_max_use: 1G # 默认系统日志最大使用空间
runtime_max_use: 500M # 默认运行时日志最大使用空间
privoxy: # 系统代理配置
enable: false #
socks5_host: 127.0.0.1
socks5_port: 1080
#config_temp:
# k8s-node:
# dns_servers:

View File

@ -17,6 +17,9 @@
script: files/install-packages.sh
when: (ansible_facts['distribution'] == "Ubuntu") or (ansible_facts['distribution'] == "Debian")
- name: Include Privoxy sub task for SOCKS5 to HTTP proxy (optional)
include_tasks: setup-privoxy.yml
when: privoxy.enable | default(false)
#- name: Include GPU Configuration
# include_tasks: include_gpu.yaml

View File

@ -0,0 +1,24 @@
---
- name: Install privoxy (Debian)
apt:
name: privoxy
state: present
when: ansible_os_family == 'Debian'
- name: Install privoxy (RedHat)
yum:
name: privoxy
state: present
when: ansible_os_family == 'RedHat'
- name: Ensure SOCKS5 forwarding is configured in privoxy
lineinfile:
path: /etc/privoxy/config
line: "forward-socks5t / {{ proxy.socks5_host }}:{{ proxcy.socks5_port }} ."
state: present
- name: Restart and enable privoxy
systemd:
name: privoxy
state: restarted
enabled: yes