自定义 harbor 安装路径 (#1209)

pull/1215/head
WeiLai 2022-12-16 09:24:25 +08:00 committed by GitHub
parent 67a70a6bdf
commit 21a2d7c0a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 11 deletions

View File

@ -198,6 +198,7 @@ network_check_schedule: "*/5 * * * *"
# harbor version完整版本号
HARBOR_VER: "__harbor__"
HARBOR_DOMAIN: "harbor.easzlab.io.local"
HARBOR_PATH: /var/data
HARBOR_TLS_PORT: 8443
# if set 'false', you need to put certs named harbor.pem and harbor-key.pem in directory 'down'

View File

@ -1,12 +1,12 @@
- name: 创建 /var/data 目录
- name: 创建 {{ HARBOR_PATH }} 目录
file:
path: /var/data
path: "{{ HARBOR_PATH }}"
state: directory
mode: 0755
# 注册变量 result如果 /var/data 目录下存在 registry 目录说明已经安装过 harbor则不进行安装
# 注册变量 result如果 {{ HARBOR_PATH }} 目录下存在 registry 目录说明已经安装过 harbor则不进行安装
- name: 注册变量 result
command: ls /var/data
command: ls {{ HARBOR_PATH }}
register: result
- block:
@ -28,13 +28,13 @@
- name: 下发 harbor 离线安装包
copy:
src: "{{ base_dir }}/down/harbor-offline-installer-{{ HARBOR_VER }}.tgz"
dest: "/var/data/harbor-offline-installer-{{ HARBOR_VER }}.tgz"
dest: "{{ HARBOR_PATH }}/harbor-offline-installer-{{ HARBOR_VER }}.tgz"
- name: 解压 harbor 离线安装包
shell: "cd /var/data && tar zxf harbor-offline-installer-{{ HARBOR_VER }}.tgz"
shell: "cd {{ HARBOR_PATH }} && tar zxf harbor-offline-installer-{{ HARBOR_VER }}.tgz"
- name: 导入 harbor 所需 docker images
shell: "{{ bin_dir }}/docker load -i /var/data/harbor/harbor.{{ HARBOR_VER }}.tar.gz"
shell: "{{ bin_dir }}/docker load -i {{ HARBOR_PATH }}/harbor/harbor.{{ HARBOR_VER }}.tar.gz"
- block:
- name: 创建 harbor 证书请求
@ -65,10 +65,10 @@
when: 'not HARBOR_SELF_SIGNED_CERT|bool'
- name: 准备 harbor 配置文件
template: src=harbor-{{ HARBOR_VER_MAIN }}.yml.j2 dest=/var/data/harbor/harbor.yml
template: src=harbor-{{ HARBOR_VER_MAIN }}.yml.j2 dest={{ HARBOR_PATH }}/harbor/harbor.yml
#- name: 配置 harbor.yml 文件
#template: src=harbor-{{ HARBOR_VER_MAIN }}.yml.j2 dest=/var/data/harbor/harbor.yml
#template: src=harbor-{{ HARBOR_VER_MAIN }}.yml.j2 dest={{ HARBOR_PATH }}/harbor/harbor.yml
#when: HARBOR_VER_MAIN in ["v1.8", "v1.9", "v1.10"]
- set_fact: HARBOR_INST_OPS="{{ HARBOR_INST_OPS }} --with-chartmuseum"
@ -86,7 +86,7 @@
- debug: var="HARBOR_INST_OPS"
- name: 安装 harbor
shell: "cd /var/data/harbor && \
shell: "cd {{ HARBOR_PATH }}/harbor && \
export PATH={{ bin_dir }}:$PATH && \
./install.sh {{ HARBOR_INST_OPS }} >> /tmp/harbor-`date +'%Y%m%d%H%M%S'`.log 2>&1"
when: '"registry" not in result.stdout'

View File

@ -27,7 +27,7 @@ database:
max_open_conns: 1000
# The default data volume
data_volume: /var/data
data_volume: {{ HARBOR_PATH }}
# Clair configuration
clair: