16 Star 91 Fork 13

Gitee 极速下载/pigsty

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/Vonng/pigsty
克隆/下载
cache.yml 3.14 KB
一键复制 编辑 原始数据 按行查看 历史
Vonng 提交于 2024-08-31 10:51 . bump version string to v3.0.1
#!/usr/bin/env ansible-playbook
---
#==============================================================#
# File : cache.yml
# Desc : make offline package cache from target nodes
# Ctime : 2024-08-22
# Mtime : 2024-08-22
# Path : cache.yml
# Author : Ruohang Feng ([email protected])
# License : AGPLv3
#==============================================================#
# the default dir for collecting offline package is dist/${version}
- name: CREATE LOCAL DIR
become: no
hosts: localhost
gather_facts: no
tags: cache_dir
tasks:
- name: create local directory
file: path={{ cache_pkg_dir|default('dist/${version}') | replace('${version}', version|default('v3.0.1')) }} state=directory
# gather offline packages from target nodes (the infra node with repo enabled)
- name: MAKE OFFLINE PACKAGE
hosts: all
become: yes
gather_facts: no
vars:
#version: v3.0.1
#cache_pkg_dir: 'dist/${version}' # where to store the cached package? dist/${version} by default
#cache_pkg_name: 'pigsty-pkg-${version}.${os}.${arch}.tgz' # cache offline package filename pattern
#cache_repo: pigsty # target repo(s) to be cached, use `,` to separate multiple repos
#cache_gf_plugin: false # cache grafana plugins, overwriting existing tarball?
roles:
- { role: node_id , tags: id } # get node identity (always)
- { role: cache , tags: cache } # make offline package
# the default dir for collecting offline package is dist/${version}
- name: CREATE LOCAL DIR
become: no
hosts: localhost
gather_facts: no
tags: cache_info
tasks:
- name: calculate cache tarball md5 checksum
shell: |
cd {{ cache_pkg_dir|default('dist/${version}') | replace('${version}', version|default('v3.0.1')) }}
md5sum *.tgz > checksums
cat checksums
ls -lh *.tgz
register: cache_md5
- name: show cache tarball md5 checksum
debug:
msg: "{{ cache_md5.stdout_lines }}"
#---------------------------------------------------------------
# Usage
#---------------------------------------------------------------
# 1. make sure your nodes are already installed with pigsty!
# 2. make sure target nodes are the infra nodes with repo enabled!
#
# cache.yml -l infra # make offline package from the infra group
# cache.yml -l 10.10.10.10 # make offline package from the ad hoc node
#
# The tarball will be generated @ /tmp/pkg.tgz, and copy to dist/${version}
#---------------------------------------------------------------
# Tasks
#---------------------------------------------------------------
# cache_dir : create local dist dir for cache tarball
# id : calculate node identity
# cache_id : calculate cache tarball name
# cache_check : check repo directories exists
# cache_plugin : cache grafana plugins (optional)
# cache_create : adjust and recreate local yum/apt repo
# cache_tgz : make cache tarball from local repos
# cache_fetch : fetch cache tarball from target nodes
# cache_info : generate cache md5sum and print size
#---------------------------------------------------------------
...
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mirrors/pigsty.git
[email protected]:mirrors/pigsty.git
mirrors
pigsty
pigsty
dev

搜索帮助