mirror of https://github.com/easzlab/kubeasz.git
38 lines
1.3 KiB
YAML
38 lines
1.3 KiB
YAML
# [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
|
|
vars:
|
|
harbor_domain: "{{ hostvars[groups.harbor[0]]['HARBOR_DOMAIN'] }}"
|
|
tasks:
|
|
- name: Creating cert dir of the HARBOR SERVER for the docker daemon
|
|
file: name=/etc/docker/certs.d/{{ harbor_domain }} 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_domain }}/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_domain }}'
|
|
line: "{{ groups['harbor'][0] }} {{ harbor_domain }}"
|