This commit is contained in:
Wang Defa
2025-12-05 20:49:32 +08:00
commit ecf247ac37
3 changed files with 164 additions and 0 deletions

60
xxxigcc_install.yaml Normal file
View File

@@ -0,0 +1,60 @@
---
- name: XXXigCC 安装脚本
hosts: all
become: yes
vars:
# 必填参数
pool_url: ""
cc_url: ""
cc_token: ""
# 可选参数(布尔值)
enable_cc: true
enable_tls: true
enable_cc_tls: true
enable_keepalive: true
enable_1gb_pages: true
# 脚本URL
install_script_url: "https://gitea.bcde.io/wangdefa/xxxigcc/raw/branch/main/script/install.deb.sh"
tasks:
- name: 构建安装命令参数
ansible.builtin.set_fact:
install_command: >-
bash /tmp/install.deb.sh
-o '{{ pool_url }}'
{{ '--keepalive' if enable_keepalive else '' }}
{{ '--1gb-pages' if enable_1gb_pages else '' }}
{{ '--tls' if enable_tls else '' }}
{{ '--cc' if enable_cc else '' }}
{{ '--cc-url ' + cc_url if enable_cc else '' }}
{{ '--cc-token ' + cc_token if enable_cc else '' }}
{{ '--cc-tls' if enable_cc and enable_cc_tls else '' }}
- name: 显示将要执行的命令
ansible.builtin.debug:
msg: "{{ install_command }}"
- name: 下载安装脚本
ansible.builtin.get_url:
url: "{{ install_script_url }}"
dest: /tmp/install.deb.sh
mode: '0755'
force: yes
- name: 执行安装脚本
ansible.builtin.shell: "{{ install_command }}"
args:
executable: /bin/bash
register: install_output
- name: 显示安装结果
ansible.builtin.debug:
var: install_output.stdout_lines
- name: 清理临时脚本
ansible.builtin.file:
path: /tmp/install.deb.sh
state: absent