websoft9/apps/roles/mingdao/tasks/main.yml
2022-11-23 13:58:23 +08:00

75 lines
2.5 KiB
YAML

- name: Install {{appname}}
include_tasks: tasks/install_without_docker.yml
vars:
app: "mingdao"
- name: Create a directory if it does not exist
file:
path: /data/apps/mingdao/installer
state: directory
recurse: yes
- name: Create MingDao link directory
file:
path: /usr/local/MDPrivateDeployment
state: directory
recurse: yes
- name: Create a file as the identity file and set env
shell: |
touch /data/apps/mingdao/installer/first
ln -sf /data/apps/mingdao/installer /usr/local/MDPrivateDeployment
echo "vm.max_map_count = 262144" >> /etc/sysctl.conf
sysctl -p
- name: Pull mingdao docker image & change tag for automatic installation
shell: |
docker pull mdpublic/mingdaoyun-community
docker pull mdpublic/mingdaoyun-doc
docker tag mdpublic/mingdaoyun-community:latest registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-community:{{mingdao_version}}
docker rmi mdpublic/mingdaoyun-community:latest
docker tag mdpublic/mingdaoyun-doc:latest registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc:{{mingdao_doc_version}}
docker rmi mdpublic/mingdaoyun-doc:latest
- name: Download mingdao installation tool from {{mingdao_download_url}}
shell: |
wget -N {{mingdao_download_url}}
tar -xzvf mingdaoyun_private_deployment_captain_linux_amd64.tar.gz
rm -f mingdaoyun_private_deployment_captain_linux_amd64.tar.gz
args:
chdir: /data/apps/mingdao/installer
- name: Copy mingdao service
copy:
src: mingdao.service
dest: /lib/systemd/system/mingdao.service
- name: Stay running state
shell: |
echo "tail -f /dev/null" >> /data/apps/mingdao/installer/service.sh
- name: Restart and Enable mingdao service
systemd:
state: restarted
daemon_reload: yes
name: mingdao
enabled: yes
- name: Create symbolic link
file:
src: '{{item.src}}'
dest: '{{item.dest}}'
state: link
with_items:
- {src: /data/mingdao,dest: /data/apps/mingdao/data}
- {src: /data/mingdao/script/volume,dest: /data/apps/mingdao/volume}
# display version
- name: Check mingdao version
shell: >
sudo echo "mingdao version:" $(docker images |grep mingdaoyun-community |awk '{print $2}') |tee -a /data/logs/install_version.txt
- name: Check mingdao doc version
shell: >
sudo echo "mingdao doc version:" $(docker images |grep mingdaoyun-doc |awk '{print $2}') |tee -a /data/logs/install_version.txt