From b2dac2f66f4d3093f74ebedb436da5c61b8f0263 Mon Sep 17 00:00:00 2001 From: Patrick Hermann Date: Wed, 31 Dec 2025 11:14:01 +0000 Subject: [PATCH] feat: feat/add-minimal-ansiblerun-claim --- .pre-commit-config.yaml | 3 ++ dev/ansible-run/README.md | 32 ++++++++++++++++++++- dev/ansible-run/apis/composition.yaml | 4 +-- dev/ansible-run/apis/definition.yaml | 4 +-- dev/ansible-run/examples/claim-minimal.yaml | 26 +++++++++++++++++ dev/ansible-run/examples/claim.yaml | 8 +++--- 6 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 dev/ansible-run/examples/claim-minimal.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db87f4f..2dd0058 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,3 +43,6 @@ repos: language: python # for backward compatibility files: .* # all files + args: + - "--exclude-files" + - "dev/ansible-run/README.md" diff --git a/dev/ansible-run/README.md b/dev/ansible-run/README.md index c1460d7..d13681a 100644 --- a/dev/ansible-run/README.md +++ b/dev/ansible-run/README.md @@ -7,4 +7,34 @@ crossplane render examples/claim.yaml \ apis/composition.yaml \ examples/functions.yaml \ --include-function-results -``` \ No newline at end of file +``` + +## RENDER KCL + +```bash +kcl run oci://ghcr.io/stuttgart-things/kcl-tekton-pr --tag 0.4.2 -D params='{ + "oxr": { + "spec": { + "pipelineRunName": "run-ansible-test1", + "namespace": "tekton-ci", + "ansibleCredentialsSecretName": "ansible-credentials", + "ansiblePlaybooks": [ + "sthings.baseos.setup" + ], + "ansibleVarsFile": [ + "manage_filesystem+-true", + "update_packages+-true", + "ansible_become+-true", + "ansible_become_method+-sudo" + ], + "ansibleVarsInventory": [ + "all+[\"10.31.102.107\"]" + ], + "wrapInCrossplane": true, + "crossplaneObjectName": "run-ansible-test", + "crossplaneNamespace": "default", + "crossplaneProviderConfig": "dev" + } + } +}' --format yaml +``` diff --git a/dev/ansible-run/apis/composition.yaml b/dev/ansible-run/apis/composition.yaml index 91b34ef..4e770c6 100644 --- a/dev/ansible-run/apis/composition.yaml +++ b/dev/ansible-run/apis/composition.yaml @@ -13,7 +13,7 @@ spec: pipeline: - step: create-ansiblerun functionRef: - name: function-kcl + name: crossplane-contrib-function-kcl input: apiVersion: krm.kcl.dev/v1alpha1 kind: KCLInput @@ -23,4 +23,4 @@ spec: source: oci://ghcr.io/stuttgart-things/kcl-tekton-pr:0.4.1 - step: automatically-detect-ready-composed-resources functionRef: - name: function-auto-ready \ No newline at end of file + name: crossplane-contrib-function-auto-ready diff --git a/dev/ansible-run/apis/definition.yaml b/dev/ansible-run/apis/definition.yaml index 0ee8876..467f2d0 100644 --- a/dev/ansible-run/apis/definition.yaml +++ b/dev/ansible-run/apis/definition.yaml @@ -64,11 +64,11 @@ spec: description: Whether to validate the inventory default: "true" enum: ["true", "false"] - # Git Configuration gitRepoUrl: type: string description: Git repository URL + default: https://github.com/stuttgart-things/stage-time.git gitRevision: type: string description: Git branch or revision @@ -159,4 +159,4 @@ spec: - pipelineRunName - namespace - gitRepoUrl - - ansiblePlaybooks \ No newline at end of file + - ansiblePlaybooks diff --git a/dev/ansible-run/examples/claim-minimal.yaml b/dev/ansible-run/examples/claim-minimal.yaml new file mode 100644 index 0000000..a4e3493 --- /dev/null +++ b/dev/ansible-run/examples/claim-minimal.yaml @@ -0,0 +1,26 @@ +--- +apiVersion: resources.stuttgart-things.com/v1alpha1 +kind: AnsibleRun +metadata: + name: run-ansible-test1 + namespace: default +spec: + # CROSSPLANE CONFIGURATION + wrapInCrossplane: true + crossplaneObjectName: run-ansible-test-xplane + crossplaneNamespace: default + crossplaneProviderConfig: dev + # PIPELINRUN CONFIGURATION + pipelineRunName: run-ansible-xplane + namespace: tekton-ci + # ANSIBLE CONFIGURATION + ansibleCredentialsSecretName: ansible-credentials + ansiblePlaybooks: + - sthings.baseos.setup + ansibleVarsFile: + - manage_filesystem+-true + - update_packages+-true + - ansible_become+-true + - ansible_become_method+-sudo + ansibleVarsInventory: + - all+["10.31.102.107"] diff --git a/dev/ansible-run/examples/claim.yaml b/dev/ansible-run/examples/claim.yaml index ac856fa..ba218a2 100644 --- a/dev/ansible-run/examples/claim.yaml +++ b/dev/ansible-run/examples/claim.yaml @@ -26,9 +26,9 @@ spec: gitWorkspaceSubdirectory: /ansible/workdir/ # Credentials - ansibleCredentialsSecretName: ansible-credentials - ansibleCredentialsUserKey: ANSIBLE_USER - ansibleCredentialsPasswordKey: ANSIBLE_PASSWORD + ansibleCredentialsSecretName: ansible-credentials # pragma: allowlist secret + ansibleCredentialsUserKey: ANSIBLE_USER # pragma: allowlist secret + ansibleCredentialsPasswordKey: ANSIBLE_PASSWORD # pragma: allowlist secret # Ansible Roles and Collections installExtraRoles: "true" @@ -58,4 +58,4 @@ spec: crossplaneObjectName: ansible-pipeline-test-6 crossplaneNamespace: default crossplaneProviderConfig: kubernetes-provider - crossplaneTimeout: "60" \ No newline at end of file + crossplaneTimeout: "60"