forked from easzlab/kubeasz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
更新harbor v1.5.2,优化安装流程允许连接已有harbor仓库
- Loading branch information
Showing
8 changed files
with
70 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# harbor version | ||
HARBOR_VER: "v1.5.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,50 @@ | ||
- name: 下载docker compose 二进制文件 | ||
copy: src={{ base_dir }}/bin/docker-compose dest={{ bin_dir }}/docker-compose mode=0755 | ||
|
||
- name: 创建data目录 | ||
file: | ||
path: /data | ||
state: directory | ||
mode: 0755 | ||
|
||
# 注册变量result,根据result结果判断是否已经安装过harbor | ||
# result|failed 说明没有安装过harbor,下一步进行安装 | ||
# result|succeeded 说明已经安装过harbor,下一步跳过安装 | ||
# 注册变量result,如果/data目录下存在registry目录说明已经安装过harbor,则不进行安装 | ||
- name: 注册变量result | ||
command: ls /data/registry | ||
command: ls /data | ||
register: result | ||
ignore_errors: True | ||
|
||
- name: 安装解压工具 | ||
package: name={{ item }} state=present | ||
with_items: | ||
- zip | ||
- unzip | ||
|
||
- name: 解压harbor离线安装包 | ||
unarchive: | ||
src: "{{ base_dir }}/down/harbor-offline-installer-v1.5.1.zip" | ||
dest: /data | ||
copy: yes | ||
keep_newer: yes | ||
mode: 0755 | ||
when: result is failed | ||
|
||
- name: 导入harbor所需 docker images | ||
shell: "{{ bin_dir }}/docker load -i /data/harbor/harbor.v1.5.1.tar.gz" | ||
when: result is failed | ||
|
||
- name: 创建harbor证书请求 | ||
template: src=harbor-csr.json.j2 dest={{ ca_dir }}/harbor-csr.json | ||
when: result is failed | ||
|
||
- name: 创建harbor证书和私钥 | ||
shell: "cd {{ ca_dir }} && {{ bin_dir }}/cfssl gencert \ | ||
-ca={{ ca_dir }}/ca.pem \ | ||
-ca-key={{ ca_dir }}/ca-key.pem \ | ||
-config={{ ca_dir }}/ca-config.json \ | ||
-profile=kubernetes harbor-csr.json | {{ bin_dir }}/cfssljson -bare harbor" | ||
when: result is failed | ||
|
||
- name: 配置 harbor.cfg 文件 | ||
template: src=harbor.cfg.j2 dest=/data/harbor/harbor.cfg | ||
when: result is failed | ||
|
||
- name: 安装 harbor | ||
shell: "cd /data/harbor && \ | ||
export PATH={{ bin_dir }}:$PATH && \ | ||
./install.sh --with-clair" | ||
when: result is failed | ||
- block: | ||
- name: 下载docker compose 二进制文件 | ||
copy: src={{ base_dir }}/bin/docker-compose dest={{ bin_dir }}/docker-compose mode=0755 | ||
|
||
- name: 安装解压工具 | ||
package: name={{ item }} state=present | ||
with_items: | ||
- zip | ||
- unzip | ||
|
||
- name: 解压harbor离线安装包 | ||
unarchive: | ||
src: "{{ base_dir }}/down/harbor-offline-installer-{{ HARBOR_VER }}.zip" | ||
dest: /data | ||
copy: yes | ||
keep_newer: yes | ||
mode: 0755 | ||
|
||
- name: 导入harbor所需 docker images | ||
shell: "{{ bin_dir }}/docker load -i /data/harbor/harbor.{{ HARBOR_VER }}.tar.gz" | ||
|
||
- name: 创建harbor证书请求 | ||
template: src=harbor-csr.json.j2 dest={{ ca_dir }}/harbor-csr.json | ||
|
||
- name: 创建harbor证书和私钥 | ||
shell: "cd {{ ca_dir }} && {{ bin_dir }}/cfssl gencert \ | ||
-ca={{ ca_dir }}/ca.pem \ | ||
-ca-key={{ ca_dir }}/ca-key.pem \ | ||
-config={{ ca_dir }}/ca-config.json \ | ||
-profile=kubernetes harbor-csr.json | {{ bin_dir }}/cfssljson -bare harbor" | ||
|
||
- name: 配置 harbor.cfg 文件 | ||
template: src=harbor.cfg.j2 dest=/data/harbor/harbor.cfg | ||
|
||
- name: 安装 harbor | ||
shell: "cd /data/harbor && \ | ||
export PATH={{ bin_dir }}:$PATH && \ | ||
./install.sh --with-clair" | ||
when: '"registry" not in result.stdout' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters