-
Notifications
You must be signed in to change notification settings - Fork 0
/
03_add-harbor.yml
56 lines (50 loc) · 1.16 KB
/
03_add-harbor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
#- name: test
# gather_facts: false
# hosts: harbor
# tasks:
# - name: test
# debug:
# msg:
# - "{{ NEW_INSTALL }}"
# - "NEW_INSTALL"
# - "{{ groups['harbor'][0] }}"
# - "{{ groups['harbor'] }}"
# - "{{ groups['k8s'] }}"
# - "{{ inventory_hostname }}"
# - "{{ hostvars[inventory_hostname] }}"
- name: 00更新tls
gather_facts: false
hosts: localhost
roles:
- tls
tags: harbor
- name: 01安装harbor
gather_facts: false
hosts: harbor
roles:
- docker
- harbor
tags: harbor
- name: 02更新harbor dns
gather_facts: false
hosts:
- harbor
tasks:
- name: /etc/hosts添加DNS
lineinfile:
dest: /etc/hosts
state: present
regexp: '{{ HARBOR_DOMAIN }}'
line: "{{ groups['harbor'][0] }} {{ HARBOR_DOMAIN }}"
tags: harbor
- name: 03 docker登录harbor
gather_facts: false
hosts:
- harbor
tasks:
- name: docker登录harbor
shell: echo {{ HARBOR_PASSWORD }} | docker login -u admin --password-stdin https://{{ HARBOR_REGISTRY }}
tags: harbor_login
tags: harbor
#退出登录 rm -rf /root/.docker/config.json