2018-09-29 09:06:19 +08:00
|
|
|
# [optional] to set up a HARBOR, and to integrate the HARBOR with k8s cluster
|
|
|
|
# read the guide: 'guide/harbor.md'
|
|
|
|
|
2021-02-08 21:23:00 +08:00
|
|
|
### --- install harbor ---
|
2017-12-25 15:05:21 +08:00
|
|
|
- hosts: harbor
|
|
|
|
roles:
|
2021-02-08 21:23:00 +08:00
|
|
|
- { role: os-harden, when: "NEW_INSTALL|bool and OS_HARDEN|bool" }
|
|
|
|
- { role: chrony, when: "NEW_INSTALL|bool and groups['chrony']|length > 0" }
|
|
|
|
- { role: prepare, when: "NEW_INSTALL|bool" }
|
|
|
|
- { role: docker, when: "NEW_INSTALL|bool" }
|
|
|
|
- { role: harbor, when: "NEW_INSTALL|bool" }
|
2017-12-25 15:05:21 +08:00
|
|
|
|
2023-09-05 20:51:47 +08:00
|
|
|
### --- config k8s nodes to work with harbor ---
|
2018-02-26 20:45:17 +08:00
|
|
|
- hosts:
|
2021-01-19 17:41:00 +08:00
|
|
|
- kube_master
|
|
|
|
- kube_node
|
2017-12-25 15:05:21 +08:00
|
|
|
tasks:
|
2018-09-29 09:06:19 +08:00
|
|
|
# [optional] if you have a DNS server, add an 'A record' instead
|
|
|
|
- name: Adding an '/etc/hosts' entry for the HARBOR DOMAIN
|
2018-05-04 22:11:08 +08:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/hosts
|
|
|
|
state: present
|
2023-05-02 17:11:18 +08:00
|
|
|
regexp: '{{ HARBOR_DOMAIN }}'
|
|
|
|
line: "{{ groups['harbor'][0] }} {{ HARBOR_DOMAIN }}"
|
2019-02-05 12:32:52 +08:00
|
|
|
when: "hostvars[groups.harbor[0]]['HARBOR_DOMAIN'] != ''"
|