websoft9/apps/roles/bt/tasks/main.yml
2022-11-08 11:23:04 +08:00

79 lines
2.1 KiB
YAML

- name: Install {{appname}}
include_tasks: tasks/install_without_docker.yml
vars:
app: "bt"
- name: install expect
yum:
name: expect
state: latest
when: ansible_os_family == "RedHat"
- name: install expect for ubuntu
apt:
name: expect
state: latest
when: ansible_os_family == "Debian"
##------ download script start ------ ###
- name: download Chinese install.sh for {{ansible_os_family}}
get_url:
url: "{{bt_download_url[ansible_os_family].zh}}"
dest: /root/install.sh
mode: '0644'
when: bt_language == 'zh'
- name: download English install.sh for {{ansible_os_family}}
get_url:
url: "{{bt_download_url[ansible_os_family].en}}"
dest: /root/install.sh
mode: '0644'
when: bt_language == 'en'
##------ download script end ------ ###
- name: copy bt install script
copy: src=bt.exp dest=/root/bt.exp mode=0644
- name: copy change username & password script for English
copy: src=en-{{item}} dest=/root/{{item}} mode=0644
with_items: "{{bt_filelist}}"
when: bt_language == 'en'
- name: copy change username & password script for Chinese
copy: src=zh-{{item}} dest=/root/{{item}} mode=0644
with_items: "{{bt_filelist}}"
when: bt_language == 'zh'
# this step may get error most of times
- name: install bt, waiting for 5-10 mins
command: expect /root/bt.exp
ignore_errors: yes
- name: change username & password
command: expect /root/{{item}}
with_items: "{{bt_filelist}}"
ignore_errors: yes
- name: remove extra files
shell: |
cp /root/password.exp /data/apps/bt/password.exp
rm -f /root/*.exp
- name: close bt-panel security login
file:
path: /www/server/panel/data/admin_path.pl
state: absent
- name: Create log folder because bt is before the common
file:
path: '/data/{{item}}'
state: directory
recurse: yes
mode: '0755'
with_items:
- logs
- name: Check BT Version
shell: sudo echo "bt version:" $(curl -Ss http://www.bt.cn/api/panel/get_version) |sudo tee -a /data/logs/install_version.txt