diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 45c34d9..2f0057f 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -18,7 +18,7 @@ jobs: name: Lint yaml files uses: stuttgart-things/stuttgart-things/.github/workflows/lint-yaml.yaml@yaml-lint-1 with: - runs-on: ghr-create-send-webhook-labda-test + runs-on: ghr-create-send-webhook-skyami-cicd environment-name: k8s continue-error: true yamllint-version: 1 @@ -29,7 +29,7 @@ jobs: name: Lint ansible code uses: stuttgart-things/stuttgart-things/.github/workflows/lint-ansible.yaml@main # ansible-lint-24.2.1 with: - runs-on: ghr-create-send-webhook-labda-test + runs-on: ghr-create-send-webhook-skyami-cicd environment-name: k8s continue-error: true ansible-image: eu.gcr.io/stuttgart-things/sthings-ansible:9.3.0-1 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 610e171..e98e19f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,5 +22,5 @@ jobs: release-message: "${{ github.event.inputs.release-message }}" environment-name: k8s archive-kind: tar.gz - runs-on: ghr-create-send-webhook-labda-test + runs-on: ghr-create-send-webhook-skyami-cicd continue-error: false diff --git a/README.md b/README.md index 19e2d31..3c43133 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,10 @@ EOF ansible-playbook create-send-webhook.yaml -vv ``` +```bash +ansible-playbook create-send-webhook.yaml -e send_to_homerun=true -vv +``` + diff --git a/defaults/main.yaml b/defaults/main.yaml index df878bf..82f7fc6 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -2,8 +2,21 @@ # defaults file for create-send-webhook send_to_msteams: false send_to_elastic: false +send_to_homerun: false install_webhook_server: false +title: "Testnachricht" +message: "Das ist eine Testnachricht" +severity: "Info" +author: "Max Mustermann" +timestamp: "{{ ansible_date_time.date }} {{ ansible_date_time.hour }}:{{ ansible_date_time.minute }}:{{ ansible_date_time.second }}" +system: "Testsystem" +technologyTags: "Test" +assigneeAddress: "" +assigneeName: "Max Mustermann" +artifacts: "https://www.google.com" +url: "https://www.google.com" + ignore_webhook_errors: false logo_pic: "https://www.clipartmax.com/png/middle/120-1208387_cereal-guy-interested-by-rober-raik-cereal-guy-meme-png.png" failure_pic: "https://anthillonline.com/wp-content/uploads/2020/06/failure.png" diff --git a/tasks/main.yaml b/tasks/main.yaml index 555a763..733244c 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -10,3 +10,7 @@ - name: Install webhook-server ansible.builtin.include_tasks: install-webhook-server.yaml when: install_webhook_server|bool + +- name: Send notification to Homerun + ansible.builtin.include_tasks: send-to-homerun.yaml + when: send_to_homerun|bool diff --git a/tasks/send-to-homerun.yaml b/tasks/send-to-homerun.yaml new file mode 100644 index 0000000..35d706e --- /dev/null +++ b/tasks/send-to-homerun.yaml @@ -0,0 +1,28 @@ +- name: Sende Daten an die API + uri: + url: https://homerun.homerun-dev.sthings-vsphere.labul.sva.de/generic + method: POST + body: | + { + "Title": "{{ title }}", + "Info": "{{ message }}", + "Severity": "{{ severity }}", + "Author": "{{ author }}", + "Timestamp": "{{ timestamp }}", + "System": "{{ system }}", + "Tags": "{{ technologyTags }}", + "AssigneeAddress": "{{ assigneeAddress }}", + "AssigneeName": "{{ assigneeName }}", + "Artifacts": "{{ artifacts }}", + "Url": "{{ url }}" + } + body_format: json + headers: + Content-Type: "application/json" + X-Auth-Token: "IhrGeheimerToken" + status_code: 200 + register: response + +- name: Zeige Antwort + debug: + var: response \ No newline at end of file