Skip to content

Commit

Permalink
gitlab first pass (#104)
Browse files Browse the repository at this point in the history
Co-authored-by: willtome <[email protected]>
  • Loading branch information
dlemons-redhat and willtome authored Oct 16, 2023
1 parent 5f8bd89 commit 98416fc
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 0 deletions.
130 changes: 130 additions & 0 deletions openshift/gitlab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
- name: Deploy gitlab on OCP
hosts: localhost
gather_facts: false

tasks:
- name: create cert-manager-operator namespace
redhat.openshift.k8s:
name: cert-manager-operator
api_version: v1
kind: Namespace
state: present

- name: create OperatorGroup object for cert-manager-operator
redhat.openshift.k8s:
state: present
definition:
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: cert-manager-operator-operatorgroup
namespace: cert-manager-operator
spec:
targetNamespaces:
- cert-manager-operator

- name: create cert-manager-operator subscription
redhat.openshift.k8s:
state: present
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
labels:
operators.coreos.com/openshift-cert-manager-operator.cert-manager-operator: ''
name: openshift-cert-manager-operator
namespace: cert-manager-operator
spec:
channel: stable-v1
installPlanApproval: Automatic
name: openshift-cert-manager-operator
source: redhat-operators
sourceNamespace: openshift-marketplace

- name: create gitlab-system namespace
redhat.openshift.k8s:
name: gitlab-system
api_version: v1
kind: Namespace
state: present

- name: create OperatorGroup object for gitlab-operator-kubernetes
redhat.openshift.k8s:
state: present
definition:
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: gitlab-operator-kubernetes-operatorgroup
namespace: gitlab-system
spec:
targetNamespaces:
- gitlab-system

- name: create gitlab subscription
redhat.openshift.k8s:
state: present
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
labels:
operators.coreos.com/gitlab-operator-kubernetes.gitlab-system: ''
name: gitlab-operator-kubernetes
namespace: gitlab-system
spec:
channel: stable
installPlanApproval: Automatic
name: gitlab-operator-kubernetes
source: community-operators
sourceNamespace: openshift-marketplace

- name: wait for gitlab operator to install
k8s_info:
api_version: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
name: gitlabs.apps.gitlab.com
register: crd_gitlab
until: crd_gitlab.resources | list | length == 1
retries: 10
delay: 30

- name: Wait until gitlab-operator is up
k8s_info:
api_version: v1
kind: Deployment
name: gitlab-controller-manager
namespace: gitlab-system
register: pod_list
until: pod_list | json_query('resources[*].status.readyReplicas') | unique >= [1]
retries: 10
delay: 30

- name: Deploy a GitLab instance
redhat.openshift.k8s:
state: present
definition:
apiVersion: apps.gitlab.com/v1beta1
kind: GitLab
metadata:
name: gitlab
namespace: gitlab-system
spec:
chart:
version: "6.11.0"
values:
nginx-ingress:
enabled: false
certmanager:
install: false
global:
hosts:
domain: "{{ cluster_domain }}" # apps.cluster-9xrlv.9xrlv.sandbox644.opentlc.com
ingress:
class: none
configureCertmanager: true
annotations:
route.openshift.io/termination: "edge"
certmanager-issuer:
email: "{{ cert_email | default('[email protected]') }}"
21 changes: 21 additions & 0 deletions openshift/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,24 @@ controller_templates:
notification_templates_error: Telemetry
credentials:
- "OpenShift Credential"

- name: OpenShift / GitLab
job_type: run
inventory: "Demo Inventory"
project: "Ansible official demo project"
playbook: "openshift/gitlab.yml"
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- "OpenShift Credential"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Enter the base domain for your cluster
default: 'Example: apps.cluster-123ab.123ab.sandbox987.opentlc.com'
type: text
variable: cluster_domain
required: true

0 comments on commit 98416fc

Please sign in to comment.