加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
11.harbor.yml 1.51 KB
一键复制 编辑 原始数据 按行查看 历史
gjmzj 提交于 2019-02-05 12:32 . 更新 harbor 安装流程和文档
# [optional] to set up a HARBOR, and to integrate the HARBOR with k8s cluster
# read the guide: 'guide/harbor.md'
- hosts: harbor
roles:
- { role: chrony, when: "hostvars[groups.deploy[0]]['NTP_ENABLED'] == 'yes' and NEW_INSTALL == 'yes'" }
- { role: prepare, when: "NEW_INSTALL == 'yes'" }
- { role: docker, when: "NEW_INSTALL == 'yes'" }
- { role: harbor, when: "NEW_INSTALL == 'yes'" }
tasks:
- name: Fetching the HARBOR SERVER's CA cert
fetch:
src: "{{ ca_dir }}/ca.pem"
dest: "{{ base_dir }}/down/"
flat: yes
- hosts:
- kube-master
- new-master
- kube-node
- new-node
tasks:
- name: Define 'harbor_host', a domain
set_fact: harbor_host="{{ hostvars[groups.harbor[0]]['HARBOR_DOMAIN'] }}"
- name: Define 'harbor_host', an IP Addr
set_fact: harbor_host="{{ groups['harbor'][0] }}"
when: "hostvars[groups.harbor[0]]['HARBOR_DOMAIN'] == ''"
- name: Creating cert dir of the HARBOR SERVER for the docker daemon
file: name=/etc/docker/certs.d/{{ harbor_host }} state=directory
- name: Installing the HARBOR SERVER's cert on k8s nodes
copy: src={{ base_dir }}/down/ca.pem dest=/etc/docker/certs.d/{{ harbor_host }}/ca.crt
# [optional] if you have a DNS server, add an 'A record' instead
- name: Adding an '/etc/hosts' entry for the HARBOR DOMAIN
lineinfile:
dest: /etc/hosts
state: present
regexp: '{{ harbor_host }}'
line: "{{ groups['harbor'][0] }} {{ harbor_host }}"
when: "hostvars[groups.harbor[0]]['HARBOR_DOMAIN'] != ''"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化