代码拉取完成,页面将自动刷新
同步操作将从 烂泥行天下/kubeasz 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# [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: "NEW_INSTALL == 'yes' and groups['chrony']|length > 0" }
- { 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
- kube-node
tasks:
- name: Define 'harbor_host', a domain name
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'] == ''
- block:
- name: Creating cert dir for the docker daemon
file: name=/etc/docker/certs.d/{{ harbor_host }} state=directory
- name: Installing the HARBOR SERVER's CA cert for docker
copy: src={{ base_dir }}/down/ca.pem dest=/etc/docker/certs.d/{{ harbor_host }}/ca.crt
when: CONTAINER_RUNTIME == 'docker'
- block:
- name: Installing the HARBOR SERVER's CA cert on k8s nodes
copy: src={{ base_dir }}/down/ca.pem dest=/usr/share/ca-certificates/harbor-ca.crt
- name: Add the HARBOR SERVER's CA cert
lineinfile:
dest: /etc/ca-certificates.conf
state: present
regexp: 'harbor-ca'
line: 'harbor-ca.crt'
- name: Update the trusted ca-certificates
shell: 'update-ca-certificates'
- name: restart containerd
service: name=containerd state=restarted
when:
- 'CONTAINER_RUNTIME == "containerd"'
- 'ansible_distribution == "Ubuntu"'
- block:
- name: Installing the HARBOR SERVER's CA cert on k8s nodes
copy: src={{ base_dir }}/down/ca.pem dest=/etc/pki/ca-trust/source/anchors/harbor-ca.crt
- name: Update the trusted ca-certificates
shell: 'update-ca-trust'
- name: restart containerd
service: name=containerd state=restarted
when:
- 'CONTAINER_RUNTIME == "containerd"'
- 'ansible_distribution in ["CentOS","RedHat","Amazon"]'
# [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'] != ''"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。