mirror of https://github.com/easzlab/kubeasz.git
自定义 harbor 安装路径 (#1209)
parent
b278aa1ef4
commit
452c79e42e
|
@ -198,6 +198,7 @@ network_check_schedule: "*/5 * * * *"
|
||||||
# harbor version,完整版本号
|
# harbor version,完整版本号
|
||||||
HARBOR_VER: "__harbor__"
|
HARBOR_VER: "__harbor__"
|
||||||
HARBOR_DOMAIN: "harbor.easzlab.io.local"
|
HARBOR_DOMAIN: "harbor.easzlab.io.local"
|
||||||
|
HARBOR_PATH: /var/data
|
||||||
HARBOR_TLS_PORT: 8443
|
HARBOR_TLS_PORT: 8443
|
||||||
|
|
||||||
# if set 'false', you need to put certs named harbor.pem and harbor-key.pem in directory 'down'
|
# if set 'false', you need to put certs named harbor.pem and harbor-key.pem in directory 'down'
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
- name: 创建 /var/data 目录
|
- name: 创建 {{ HARBOR_PATH }} 目录
|
||||||
file:
|
file:
|
||||||
path: /var/data
|
path: "{{ HARBOR_PATH }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
# 注册变量 result,如果 /var/data 目录下存在 registry 目录说明已经安装过 harbor,则不进行安装
|
# 注册变量 result,如果 {{ HARBOR_PATH }} 目录下存在 registry 目录说明已经安装过 harbor,则不进行安装
|
||||||
- name: 注册变量 result
|
- name: 注册变量 result
|
||||||
command: ls /var/data
|
command: ls {{ HARBOR_PATH }}
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
|
@ -28,13 +28,13 @@
|
||||||
- name: 下发 harbor 离线安装包
|
- name: 下发 harbor 离线安装包
|
||||||
copy:
|
copy:
|
||||||
src: "{{ base_dir }}/down/harbor-offline-installer-{{ HARBOR_VER }}.tgz"
|
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 离线安装包
|
- 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
|
- 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:
|
- block:
|
||||||
- name: 创建 harbor 证书请求
|
- name: 创建 harbor 证书请求
|
||||||
|
@ -65,10 +65,10 @@
|
||||||
when: 'not HARBOR_SELF_SIGNED_CERT|bool'
|
when: 'not HARBOR_SELF_SIGNED_CERT|bool'
|
||||||
|
|
||||||
- name: 准备 harbor 配置文件
|
- 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 文件
|
#- 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"]
|
#when: HARBOR_VER_MAIN in ["v1.8", "v1.9", "v1.10"]
|
||||||
|
|
||||||
- set_fact: HARBOR_INST_OPS="{{ HARBOR_INST_OPS }} --with-chartmuseum"
|
- set_fact: HARBOR_INST_OPS="{{ HARBOR_INST_OPS }} --with-chartmuseum"
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
- debug: var="HARBOR_INST_OPS"
|
- debug: var="HARBOR_INST_OPS"
|
||||||
|
|
||||||
- name: 安装 harbor
|
- name: 安装 harbor
|
||||||
shell: "cd /var/data/harbor && \
|
shell: "cd {{ HARBOR_PATH }}/harbor && \
|
||||||
export PATH={{ bin_dir }}:$PATH && \
|
export PATH={{ bin_dir }}:$PATH && \
|
||||||
./install.sh {{ HARBOR_INST_OPS }} >> /tmp/harbor-`date +'%Y%m%d%H%M%S'`.log 2>&1"
|
./install.sh {{ HARBOR_INST_OPS }} >> /tmp/harbor-`date +'%Y%m%d%H%M%S'`.log 2>&1"
|
||||||
when: '"registry" not in result.stdout'
|
when: '"registry" not in result.stdout'
|
||||||
|
|
|
@ -27,7 +27,7 @@ database:
|
||||||
max_open_conns: 1000
|
max_open_conns: 1000
|
||||||
|
|
||||||
# The default data volume
|
# The default data volume
|
||||||
data_volume: /var/data
|
data_volume: {{ HARBOR_PATH }}
|
||||||
|
|
||||||
# Clair configuration
|
# Clair configuration
|
||||||
clair:
|
clair:
|
||||||
|
|
Loading…
Reference in New Issue