Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/add-kaeffken-profile #2

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Verify
on:
workflow_dispatch:
push:
branches:
- "*"
pull_request:
types: [opened, reopened]

jobs:
yaml-lint:
name: Lint yaml files
uses: stuttgart-things/github-workflow-templates/.github/workflows/call-yaml-lint.yaml@feature/add-homerun-task-go
with:
runs-on: ghr-crossplane-skyami-cicd
environment-name: k8s
continue-error: false
yamllint-version: 1
lintprofile-path: .yamllint
artifact-name: yaml-lint
27 changes: 23 additions & 4 deletions configurations/ansible-run/apis/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ spec:
providerConfigRef:
name: kubernetes-labul-bootstrap
forProvider:
readinessChecks:
- type: MatchString
fieldPath: "status.conditions[?(@.type=='Succeeded')].status"
matchString: "True"
manifest:
apiVersion: tekton.dev/v1
kind: PipelineRun
Expand Down Expand Up @@ -71,6 +67,16 @@ spec:
value: "true"
- name: inventory
value: ""
- name: varsFile
value: ""
readinessChecks:
- type: MatchString
fieldPath: "status.atProvider.manifest.status.conditions[?(@.type=='Succeeded')].status"
matchString: "True"
- type: MatchString
fieldPath: "status.atProvider.manifest.status.conditions[0].type"
matchString: "Succeeded"

patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.pipelineRunName
Expand Down Expand Up @@ -111,6 +117,19 @@ spec:
- type: FromCompositeFieldPath
fromFieldPath: spec.inventoryFile
toFieldPath: spec.forProvider.manifest.spec.params[13].value
- type: FromCompositeFieldPath
fromFieldPath: spec.varsFile
toFieldPath: spec.forProvider.manifest.spec.params[14].value
- type: FromCompositeFieldPath
fromFieldPath: spec.providerRef.name
toFieldPath: spec.providerConfigRef.name
- type: ToCompositeFieldPath
fromFieldPath: status.atProvider.manifest.status
toFieldPath: status.tekton
policy:
fromFieldPath: Optional
- type: ToCompositeFieldPath
fromFieldPath: status.atProvider.manifest.status.conditions.message
toFieldPath: status.ergebnis
policy:
fromFieldPath: Optional
13 changes: 11 additions & 2 deletions configurations/ansible-run/apis/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
description: Namespace of pipelineRun resource
workingImage:
type: string
default: ghcr.io/stuttgart-things/sthings-ansible:11.0.0
default: ghcr.io/stuttgart-things/sthings-ansible:11.1.0
description: Name of pipelineRun resource
vaultSecretName:
type: string
Expand Down Expand Up @@ -66,7 +66,12 @@ spec:
default: "true"
inventoryFile:
type: string
default: ""
description: inventory file (b64 encoded)
varsFile:
type: string
default: ""
description: (additional) varsFile (b64 encoded)
roles:
type: array
description: Ansible roles
Expand Down Expand Up @@ -95,7 +100,11 @@ spec:
status:
description: A Status represents the observed state
properties:
share:
tekton:
description: Freeform field containing status information
type: object
x-kubernetes-preserve-unknown-fields: true
ergebnis:
description: Freeform field containing status information
type: object
x-kubernetes-preserve-unknown-fields: true
Expand Down
13 changes: 7 additions & 6 deletions configurations/ansible-run/examples/claim-baseos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
apiVersion: resources.stuttgart-things.com/v1alpha1
kind: AnsibleRun
metadata:
name: baseos-k3s-sprechstunde13
name: baseos-k3s-sprechstunde133
namespace: crossplane-system
spec:
pipelineRunName: baseos-k3s-sprechstunde13
pipelineRunName: baseos-k3s-sprechstunde133
createInventory: "false"
varsFile: bmFtZToga29sbGUK
inventoryFile: W2luaXRpYWxfbWFzdGVyX25vZGVdCmszcy1zcHJlY2hzdHVuZGUubGFidWwuc3ZhLmRlCgpbYWRkaXRpb25hbF9tYXN0ZXJfbm9kZXNdCg== # pragma: allowlist secret
playbooks:
- "ansible/playbooks/prepare-env.yaml"
- "ansible/playbooks/base-os.yaml"
- "plays/prepare-env.yaml"
- "plays/base-os.yaml"
ansibleVarsFile:
- manage_filesystem+-true
- update_packages+-true
Expand All @@ -23,13 +24,13 @@ spec:
- lvm_var_sizing+-'50%'
- send_to_msteams+-true
- reboot_all+-false
gitRepoUrl: https://github.com/stuttgart-things/stuttgart-things.git
gitRepoUrl: https://github.com/stuttgart-things/ansible.git
gitRevision: main
providerRef:
name: in-cluster
vaultSecretName: vault # pragma: allowlist secret
pipelineNamespace: tekton-pipelines
workingImage: ghcr.io/stuttgart-things/sthings-ansible:11.0.0
workingImage: ghcr.io/stuttgart-things/sthings-ansible:11.1.0
roles:
- "https://github.com/stuttgart-things/install-requirements.git,2024.05.11"
- "https://github.com/stuttgart-things/manage-filesystem.git,2024.05.15"
Expand Down
51 changes: 51 additions & 0 deletions configurations/ansible-run/examples/claim-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
# BASE-OS
apiVersion: resources.stuttgart-things.com/v1alpha1
kind: AnsibleRun
metadata:
name: install-docker
namespace: crossplane-system
spec:
pipelineRunName: install-docker2
createInventory: "false"
varsFile: bmFtZToga29sbGUK # pragma: allowlist secret
inventoryFile: W2luaXRpYWxfbWFzdGVyX25vZGVdCmszcy1zcHJlY2hzdHVuZGUubGFidWwuc3ZhLmRlCgpbYWRkaXRpb25hbF9tYXN0ZXJfbm9kZXNdCg== # pragma: allowlist secret
playbooks:
- "plays/prepare-env.yaml"
- "plays/base-os.yaml"
- "sthings.container.docker"
ansibleVarsFile:
- manage_filesystem+-true
- update_packages+-true
- install_requirements+-true
- install_motd+-true
- username+-sthings
- lvm_home_sizing+-'15%'
- lvm_root_sizing+-'35%'
- lvm_var_sizing+-'50%'
- send_to_msteams+-true
- reboot_all+-false
gitRepoUrl: https://github.com/stuttgart-things/ansible.git
gitRevision: main
providerRef:
name: in-cluster
vaultSecretName: vault # pragma: allowlist secret
pipelineNamespace: tekton-pipelines
workingImage: ghcr.io/stuttgart-things/sthings-ansible:11.0.0
roles:
- "https://github.com/stuttgart-things/install-requirements.git,2024.05.11"
- "https://github.com/stuttgart-things/install-configure-docker,2024.12.30"
collections:
- community.crypto:2.22.3
- community.general:10.1.0
- ansible.posix:2.0.0
- kubernetes.core:5.0.0
- community.docker:4.1.0
- community.vmware:5.2.0
- awx.awx:24.6.1
- community.hashi_vault:6.2.0
- ansible.netcommon:7.1.0
- https://artifacts.homerun-dev.sthings-vsphere.labul.sva.de/ansible-collections/sthings-container-24.612.59.tar.gz
# - https://artifacts.homerun-dev.sthings-vsphere.labul.sva.de/ansible-collections/sthings-deploy_rke-24.2843.39.tar.gz
# - https://github.com/stuttgart-things/stuttgart-things/releases/download/0.0.86/sthings-awx-0.0.86.tar.gz
# - https://artifacts.homerun-dev.sthings-vsphere.labul.sva.de/ansible-collections/sthings-base_os-24.21.29.tar.gz
2 changes: 1 addition & 1 deletion configurations/ansible-run/examples/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ kind: Configuration
metadata:
name: ansible-run
spec:
package: ghcr.io/stuttgart-things/crossplane/ansible-run:11.0.0
package: ghcr.io/stuttgart-things/crossplane/ansible-run:11.0.0
38 changes: 38 additions & 0 deletions profiles/ansiblerun-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
preQuestions:
- prompt: "Target (hosts/group) name?"
kind: ask
name: targets
type: string
minLength: 3
maxLength: 20

- prompt: "Provisioning?"
name: provisioning
options:
- "baseos"
- "docker"

questions:
- /home/sthings/projects/crossplane/surveys/ansiblerun.yaml


templates:
- /home/sthings/projects/crossplane/templates/ansiblerun.yaml.tpl:{{ .targets }}-{{ .provisioning }}.yaml

# GENERAL
technology: crossplane

# GITHUB / BRANCH
gitRepo: stuttgart-things
gitOwner: stuttgart-things
gitBranch: "{{ .technology }}-{{ .targets }}"
rootFolder: crossplane
subFolder: "ansibleruns/{{ .provisioning }}-{{ .targets }}"
commitMessage: "Created {{ .technology }}-{{ .provisioning }}-{{ .targets }}"

# GITHUB / PULL REQUEST
prTitle: "Merge {{ .technology }}-{{ .provisioning }}-{{ .targets }}"
prDescription: "Merge {{ .technology }}-{{ .provisioning }}-{{ .targets }} {{ .technology }} definition into main"
prTags:
- crossplane
12 changes: 12 additions & 0 deletions surveys/ansiblerun.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- prompt: "Pipelinerun namespace?"
name: pipelineRunNamespace
options:
- "tekton-pipelines"

- prompt: "IP/FQDN?"
kind: ask
name: ip
type: string
minLength: 3
maxLength: 20
45 changes: 45 additions & 0 deletions templates/ansiblerun.yaml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
apiVersion: resources.stuttgart-things.com/v1alpha1
kind: AnsibleRun
metadata:
name: {{ .targets }}-{{ .provisioning }}
namespace: crossplane-system
spec:
pipelineRunName: {{ .targets }}-{{ .provisioning }}
createInventory: "true"
inventory:
- "all+[\"{{ .ip }}\"]"
playbooks:
- "plays/prepare-env.yaml"
- "plays/base-os.yaml"
ansibleVarsFile:
- manage_filesystem+-true
- update_packages+-true
- install_requirements+-true
- install_motd+-true
- username+-sthings
- lvm_home_sizing+-'15%'
- lvm_root_sizing+-'35%'
- lvm_var_sizing+-'50%'
- send_to_msteams+-true
- reboot_all+-false
gitRepoUrl: https://github.com/stuttgart-things/ansible.git
gitRevision: main
providerRef:
name: in-cluster
vaultSecretName: vault # pragma: allowlist secret
pipelineNamespace: tekton-pipelines
workingImage: ghcr.io/stuttgart-things/sthings-ansible:11.0.0
roles:
- "https://github.com/stuttgart-things/install-requirements.git,2024.05.11"
- "https://github.com/stuttgart-things/manage-filesystem.git,2024.05.15"
collections:
- community.crypto:2.22.3
- community.general:10.1.0
- ansible.posix:2.0.0
- kubernetes.core:5.0.0
- community.docker:4.1.0
- community.vmware:5.2.0
- awx.awx:24.6.1
- community.hashi_vault:6.2.0
- ansible.netcommon:7.1.0