Skip to content

Commit 0b1c895

Browse files
add ansible ci pipeline
1 parent f164730 commit 0b1c895

File tree

6 files changed

+102
-1
lines changed

6 files changed

+102
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[defaults]
2+
vars_plugins_enabled = host_group_vars,community.sops.sops
3+
pipelining = True
4+
roles_path = /workspace/source/ansible/roles
5+
executable = /bin/bash
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
apiVersion: external-secrets.io/v1beta1
3+
kind: ExternalSecret
4+
metadata:
5+
name: "github-ssh"
6+
spec:
7+
refreshInterval: 12h
8+
secretStoreRef:
9+
name: "vault"
10+
kind: "ClusterSecretStore"
11+
target:
12+
name: "github-ssh"
13+
creationPolicy: "Owner"
14+
data:
15+
- secretKey: "id_rsa" # NOTE: Make sure the private key has a newline at the end: https://github.com/tektoncd/catalog/issues/1220
16+
remoteRef:
17+
key: "secret/soeren.cloud/env/prod/cicd-ansible/github-ssh"
18+
property: "id_rsa"
19+
- secretKey: "known_hosts"
20+
remoteRef:
21+
key: "secret/soeren.cloud/env/prod/cicd-ansible/github-ssh"
22+
property: "known_hosts"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@cert-authority *.soeren.cloud ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3gtj+hdYmrOlHd3CEbk9GWkgE/wVvub2jBTCCX7OWEQAtl6y8g24v45h/sWpOd3jteb7Wi6iZzw5j0GSxzshcdfzgZX1HrOk0f8hE5RDjmpdEPHMOHKZIqjLKhf3cI5ugZ8gxI9Jlou/DBJIHkSPT55Ybo8nr/TzyfnsejynEU7Y9g2krz4zKQHuVNndn9iRQlCTj3kGKz39/QZVsyb3qAUEhLenAn/1dulfHXe+GgN3mHCq6iuYX6JYLXKA5GPUtpf6hEiEOqcrEqMaERgDtCr43SnbNrq88k/1GZk+D3MhTGFo9Z+SXyLvb14Kdb2aeKGWLhJ0lV/SzqiTpK2sgiexX5PSDqlwcGQ7w1XS3n5uRIKXfvkhue00PYBNczKFTeq6eqtTmTKlpY9vFUDkKdLGvP5XOcdVIjvJ1MMHZOblieoFkz6jMnlDV88WIYwRuT+sQgcow98gUI9plriPhBZx0Gg9zPIsO9GD3xQZ403Zaaf1CzbsgkWA2+2DfrwERLlq6ReA3zpz8cZR5pcbCzrAVrh+Y1TlzrpAcV1JBUFqyRZHp12zl79guqVolcE6kjnAR3aDlWBUCzG0+46abNMP14DdqaDNIPcqm/TwYtl8NFBNqlElXvzVa/Uy5CDQhZHg0800VdADetP38mIFKHT0A4czffZ3SDr2NER5xSw==
2+
github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
3+
gitlab.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
resources:
5+
- ../../../../cicd/ansible
6+
- external-secret-github-ssh.yaml
7+
configMapGenerator:
8+
- name: ansible-config
9+
options:
10+
disableNameSuffixHash: true
11+
files:
12+
- ansible.cfg
13+
- name: ssh-config
14+
options:
15+
disableNameSuffixHash: true
16+
files:
17+
- known_hosts
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
apiVersion: tekton.dev/v1
3+
kind: PipelineRun
4+
metadata:
5+
generateName: "ansible-"
6+
spec:
7+
pipelineRef:
8+
name: ansible
9+
taskRunTemplate:
10+
serviceAccountName: ansible
11+
podTemplate:
12+
securityContext:
13+
runAsUser: 12563
14+
runAsGroup: 12563
15+
fsGroup: 12563
16+
seccompProfile:
17+
type: RuntimeDefault
18+
runAsNonRoot: true
19+
workspaces:
20+
- name: "ssh-creds"
21+
secret:
22+
secretName: github-ssh
23+
- name: "ansible-config"
24+
configMap:
25+
name: "ansible-config"
26+
- name: "ansible-ssh-config"
27+
configMap:
28+
name: "ssh-config"
29+
- name: shared-data
30+
volumeClaimTemplate:
31+
spec:
32+
accessModes:
33+
- ReadWriteOnce
34+
storageClassName: openebs-hostpath
35+
resources:
36+
requests:
37+
storage: 1Gi
38+
params:
39+
- name: "ansible-repo-clone-url"
40+
value: "https://github.com/soerenschneider/ansible.git"
41+
- name: "ansible-inventory-repo-clone-url"
42+
value: "[email protected]:soerenschneider/ansible-inventory-prod.git"
43+
- name: "vault-address"
44+
value: "https://vault.ha.soeren.cloud"
45+
- name: "vault-ssh-role"
46+
value: "user"
47+
- name: "vault-ssh-mount"
48+
value: "ssh/clients"
49+
- name: "vault-kubernetes-auth-role"
50+
value: "cicd-ansible"
51+
- name: "vault-kubernetes-auth-mount"
52+
value: "svc.ez.soeren.cloud"
53+
- name: "playbook"
54+
value: "jukebox/playbook.yml"

clusters/common/cicd/github-releases/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
44
namespace: cicd
55
resources:
6-
- ../../../cicd/github-release
6+
- ../../../../cicd/github-release
77
- namespace.yaml

0 commit comments

Comments
 (0)