-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.yaml
86 lines (78 loc) · 2.75 KB
/
bootstrap.yaml
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
---
- hosts: all
connection: local
gather_facts: false
module_defaults:
group/k8s:
api_key: "{{ ocp_api_key }}"
host: "{{ ocp_api_host }}"
validate_certs: "{{ ocp_api_validate_certs }}"
tasks:
- name: "Install the Openshift GitOps operator"
kubernetes.core.k8s:
state: present
src: gitops/installation/gitops-operator.yaml
wait: true
- name: Wait until namespace openshift-gitops exists
kubernetes.core.k8s_info:
api_version: v1
kind: Namespace
name: openshift-gitops
register: gitops_namespace
until: gitops_namespace.resources[0] is defined and gitops_namespace.resources[0].status.phase == "Active"
retries: 100
delay: 2
- name: "Create the ArgoCD instance"
kubernetes.core.k8s:
state: present
src: gitops/installation/argocd-server.yaml
wait: true
register: argocd_res
- name: "Show the ArgoCD instance credentials"
block:
- name: Get the ArgoCD Route hostname
kubernetes.core.k8s_info:
api_version: v1
kind: Route
name: openshift-gitops-server
namespace: openshift-gitops
register: route
- name: Get the ArgoCD admin password
kubernetes.core.k8s_info:
api_version: v1
kind: Secret
name: openshift-gitops-cluster
namespace: openshift-gitops
register: secret
- debug:
msg:
- "ArgoCD Instance URL: https://{{ route.resources[0].spec.host }}"
- "ArgoCD admin password: {{ secret.resources[0].data['admin.password'] | b64decode }}"
# - name: "Create the ArgoCD secret to access gitops-demo git repo"
# kubernetes.core.k8s:
# state: present
# definition: "{{ lookup('template', 'templates/add_gitops_demo_repo.yaml.j2') }}"
# wait: true
# when:
# - argocd_repository_secret_name is defined
# - argocd_repository_password is defined
# - argocd_repository_url is defined
# - argocd_repository_username is defined
- name: Create a Namespace to deploy the apps
kubernetes.core.k8s:
state: present
definition:
name: "{{ apps_ocp_namespace | default('argocd-stress-test') }}"
api_version: v1
kind: Namespace
metadata:
name: "{{ apps_ocp_namespace | default('argocd-stress-test') }}"
labels:
openshift.io/cluster-monitoring: "true"
argocd.argoproj.io/managed-by: openshift-gitops
- name: "Create the ArgoCD Bootstrap Application"
kubernetes.core.k8s:
state: present
src: gitops/installation/argocd-app-bootstrap.yaml
wait: true
...