2017-12-25 15:05:21 +08:00
|
|
|
|
- hosts: harbor
|
|
|
|
|
roles:
|
2018-08-26 10:58:27 +08:00
|
|
|
|
- { 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: 获取harbor服务器证书
|
|
|
|
|
fetch:
|
|
|
|
|
src: "{{ ca_dir }}/ca.pem"
|
|
|
|
|
dest: "{{ base_dir }}/down/"
|
|
|
|
|
flat: yes
|
2017-12-25 15:05:21 +08:00
|
|
|
|
|
2018-02-26 20:45:17 +08:00
|
|
|
|
- hosts:
|
2018-03-16 18:23:34 +08:00
|
|
|
|
- kube-master
|
2018-05-04 22:11:08 +08:00
|
|
|
|
- new-master
|
2018-02-26 20:45:17 +08:00
|
|
|
|
- kube-node
|
|
|
|
|
- new-node
|
2018-08-23 10:35:55 +08:00
|
|
|
|
vars:
|
|
|
|
|
harbor_domain: "{{ hostvars[groups.harbor[0]]['HARBOR_DOMAIN'] }}"
|
2017-12-25 15:05:21 +08:00
|
|
|
|
tasks:
|
|
|
|
|
- name: harbor证书目录创建
|
2018-08-23 10:35:55 +08:00
|
|
|
|
file: name=/etc/docker/certs.d/{{ harbor_domain }} state=directory
|
2018-08-26 10:58:27 +08:00
|
|
|
|
|
|
|
|
|
- name: 推送harbor服务器证书
|
|
|
|
|
copy: src={{ base_dir }}/down/ca.pem dest=/etc/docker/certs.d/{{ harbor_domain }}/ca.crt
|
2017-12-25 15:05:21 +08:00
|
|
|
|
|
2018-05-04 22:11:08 +08:00
|
|
|
|
# 如果你的环境中有dns服务器,可以跳过hosts文件设置
|
2017-12-25 15:05:21 +08:00
|
|
|
|
- name: 增加harbor的hosts解析
|
2018-05-04 22:11:08 +08:00
|
|
|
|
lineinfile:
|
|
|
|
|
dest: /etc/hosts
|
|
|
|
|
state: present
|
2018-08-23 10:35:55 +08:00
|
|
|
|
regexp: '{{ harbor_domain }}'
|
|
|
|
|
line: "{{ groups['harbor'][0] }} {{ harbor_domain }}"
|