This repository has been archived by the owner on Dec 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
04-rancher-config.yml
88 lines (83 loc) · 2.42 KB
/
04-rancher-config.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
- name: Deploy sops-age-key secret
hosts: vm
tags: rancher, argocd, sops
tasks:
- name: Wait for kubeconfig to exist
become: true
ansible.builtin.wait_for:
path: "{{ kubeconfig_path }}"
timeout: 300
- name: Wait for namespace kube-system to exist
become: true
kubernetes.core.k8s_info:
kubeconfig: "{{ kubeconfig_path }}"
kind: "Namespace"
name: "kube-system"
register: namespace
retries: 60
delay: 5
until: |
namespace.resources is defined and
namespace.resources | length > 0 and
namespace.resources[0].metadata is defined and
namespace.resources[0].metadata.name is defined and
namespace.resources[0].metadata.name == "kube-system"
- name: Create ArgoCD namespace
become: true
kubernetes.core.k8s:
state: present
kubeconfig: "{{ kubeconfig_path }}"
definition:
apiVersion: v1
kind: Namespace
metadata:
name: argocd
labels:
name: argocd
- name: Add sops-age-key secret
become: true
kubernetes.core.k8s:
state: present
kubeconfig: "{{ kubeconfig_path }}"
namespace: argocd
definition:
apiVersion: v1
kind: Secret
metadata:
name: sops-age-key
type: Opaque
data:
keys.txt: "{{ agekey | b64encode }}"
- name: Deploy global Fleet project
hosts: upstream
tags: upstream, rancher, argocd, fleet
tasks:
- name: Add Fleet project
become: true
kubernetes.core.k8s:
state: present
kubeconfig: "{{ kubeconfig_path }}"
namespace: "{{ item }}"
definition:
apiVersion: fleet.cattle.io/v1alpha1
kind: GitRepo
metadata:
name: rancher-config
spec:
branch: main
insecureSkipTLSVerify: false
paths:
- /kubernetes/fleet-global
repo: https://github.com/diademiemi/project_homelab_v3.git
targets:
- clusterSelector:
matchExpressions:
- key: provider.cattle.io
operator: NotIn
values:
- harvester
loop:
- fleet-default # Deploy to downstream clusters
- fleet-local # Deploy to upstream cluster
...