Skip to content

Commit caf19ac

Browse files
authored
Add playbook to deploy and configure MCE (#32)
1 parent ca22996 commit caf19ac

File tree

5 files changed

+94
-0
lines changed

5 files changed

+94
-0
lines changed

ansible/mce-hub-deploy.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
# Playbook to deploy and setup MCE
3+
#
4+
# Example Usage:
5+
#
6+
# time ansible-playbook -i ansible/inventory/cloud30.local ansible/mce-hub-deploy.yml
7+
#
8+
9+
- name: Deploy and setup MCE
10+
hosts: bastion
11+
vars_files:
12+
- vars/all.yml
13+
roles:
14+
- mce-hub-deploy
15+
- mce-assisted-installer
16+
- mce-image-based-install
17+
- mce-add-clusterimagesets
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
# mce-hub-deploy default vars
3+
4+
mce_default_channel: stable-2.7
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
# mce-hub-deploy tasks - Install MCE from operatorhub to a cluster
3+
4+
- name: Create directory for MCE Operator
5+
file:
6+
path: "{{ install_directory }}/mce-deploy"
7+
state: directory
8+
9+
- name: Create MCE manifests
10+
template:
11+
src: "{{ item.src }}"
12+
dest: "{{ item.dest }}"
13+
loop:
14+
- src: mce-operator.yaml.j2
15+
dest: "{{ install_directory }}/mce-deploy/mce-operator.yaml"
16+
- src: mce.yaml.j2
17+
dest: "{{ install_directory }}/mce-deploy/mce.yaml"
18+
19+
- name: Apply MCE Operator manifest
20+
shell: |
21+
KUBECONFIG={{ hub_cluster_kubeconfig }} oc apply -f {{ install_directory }}/mce-deploy/mce-operator.yaml
22+
23+
- name: Wait until MCE Operator CSV is succeeded
24+
shell: |
25+
KUBECONFIG={{ hub_cluster_kubeconfig }} oc get csv -n multicluster-engine -o json | jq -r '.items[].status.phase'
26+
register: mce_succeeded
27+
until: mce_succeeded.stdout == "Succeeded"
28+
retries: 120
29+
delay: 1
30+
31+
- name: Apply MCE manifest
32+
shell: |
33+
KUBECONFIG={{ hub_cluster_kubeconfig }} oc apply -f {{ install_directory }}/mce-deploy/mce.yaml
34+
35+
- name: Wait until MultiClusterEngine is Available
36+
shell: |
37+
KUBECONFIG={{ hub_cluster_kubeconfig }} {%raw%}oc get multiclusterengine engine -o go-template='{{ .status.phase }}'{%endraw%}
38+
register: mce_available
39+
until: mce_available.stdout == "Available"
40+
retries: 300
41+
delay: 2
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: multicluster-engine
6+
---
7+
apiVersion: operators.coreos.com/v1
8+
kind: OperatorGroup
9+
metadata:
10+
name: multicluster-engine-operator-group
11+
namespace: multicluster-engine
12+
spec:
13+
targetNamespaces:
14+
- multicluster-engine
15+
---
16+
apiVersion: operators.coreos.com/v1alpha1
17+
kind: Subscription
18+
metadata:
19+
name: multicluster-engine
20+
namespace: multicluster-engine
21+
spec:
22+
installPlanApproval: Automatic
23+
name: multicluster-engine
24+
channel: {{ mce_default_channel }}
25+
source: redhat-operators
26+
sourceNamespace: openshift-marketplace
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
apiVersion: multicluster.openshift.io/v1
3+
kind: MultiClusterEngine
4+
metadata:
5+
name: engine
6+
spec: {}

0 commit comments

Comments
 (0)