feat: approve processes by messages

master
Sven Ketelsen 4 years ago
parent 1c2da22ef6
commit 4ffaedc869

@ -0,0 +1,64 @@
---
# Parameters:
# playbook inventory
# stage := the type of the stage (e.g. dev, int, qa, prod)
# tenant_id := (unique key for the tenant, e.g. customer)
# cluster_name := (business name for the cluster, e.g. product, department )
# cluster_size := (WIP node count for the cluster)
# cluster_services := (services to setup, e.g. ['connect', 'wordpress', ...])
# smardigo message callback
# scope_id := (scope id of the management process)
# process_instance_id := (process instance id of the management process)
# smardigo_management_action := (smardigo management action anme of the management process)
#############################################################
# Creating inventory dynamically for given parameters
#############################################################
- hosts: localhost
connection: local
gather_facts: false
pre_tasks:
- name: "Check if ansible version is at least 2.10.x"
assert:
that:
- ansible_version.major >= 2
- ansible_version.minor >= 10
msg: "The ansible version has to be at least ({{ ansible_version.full }})"
tasks:
- name: Add hosts
add_host:
name: "{{ stage }}-{{ tenant_id }}-{{ cluster_name }}-{{ '%02d' | format(item|int) }}"
groups:
- "stage_{{ stage }}"
- "{{ cluster_service }}"
with_sequence: start=1 end={{ cluster_count | default(1) }}
changed_when: False
#############################################################
# Sending smardigo management message to process
#############################################################
- hosts: "stage_{{ stage }}"
serial: "{{ serial_number | default(5) }}"
connection: local
gather_facts: false
post_tasks:
- name: "Sending smardigo management message <{{ smardigo_management_action }}> to <{{ scope_id }}/{{ process_instance_id }}>"
uri:
url: "{{ smardigo_management_url }}"
method: POST
body_format: json
body: "{{ lookup('template','smardigo-process-approved-message.json.j2') }}"
headers:
accept: "*/*"
Content-Type: "application/json"
Smardigo-User-Token: "{{ smardigo_management_token }}"
status_code: [200]
retries: 5
delay: 5
delegate_to: 127.0.0.1

@ -122,6 +122,7 @@ Variables.userId(authenticatedUserId)</camunda:script>
</camunda:inputOutput> </camunda:inputOutput>
</bpmn2:extensionElements> </bpmn2:extensionElements>
<bpmn2:incoming>Flow_1cvz8xm</bpmn2:incoming> <bpmn2:incoming>Flow_1cvz8xm</bpmn2:incoming>
<bpmn2:incoming>Flow_14pzxys</bpmn2:incoming>
<bpmn2:outgoing>Flow_1w2pl97</bpmn2:outgoing> <bpmn2:outgoing>Flow_1w2pl97</bpmn2:outgoing>
</bpmn2:intermediateThrowEvent> </bpmn2:intermediateThrowEvent>
<bpmn2:intermediateThrowEvent id="Event_081pcx9" name="Antrag abbrechen"> <bpmn2:intermediateThrowEvent id="Event_081pcx9" name="Antrag abbrechen">
@ -523,7 +524,7 @@ Variables.userId(authenticatedUserId)</camunda:script>
<bpmn2:incoming>Flow_090j3ro</bpmn2:incoming> <bpmn2:incoming>Flow_090j3ro</bpmn2:incoming>
<bpmn2:outgoing>Flow_0yckijr</bpmn2:outgoing> <bpmn2:outgoing>Flow_0yckijr</bpmn2:outgoing>
</bpmn2:intermediateThrowEvent> </bpmn2:intermediateThrowEvent>
<bpmn2:sequenceFlow id="Flow_121fu5x" sourceRef="Activity_1ffsvy2" targetRef="Event_0pybjkb" /> <bpmn2:sequenceFlow id="Flow_121fu5x" sourceRef="Activity_1ffsvy2" targetRef="Gateway_0ppveul" />
<bpmn2:callActivity id="Activity_1ffsvy2" name="Management Benachrichtigung senden" calledElement="smardigo-management-message"> <bpmn2:callActivity id="Activity_1ffsvy2" name="Management Benachrichtigung senden" calledElement="smardigo-management-message">
<bpmn2:extensionElements> <bpmn2:extensionElements>
<camunda:in businessKey="#{execution.processBusinessKey}" /> <camunda:in businessKey="#{execution.processBusinessKey}" />
@ -535,9 +536,6 @@ Variables.userId(authenticatedUserId)</camunda:script>
<bpmn2:incoming>Flow_1qghkm9</bpmn2:incoming> <bpmn2:incoming>Flow_1qghkm9</bpmn2:incoming>
<bpmn2:outgoing>Flow_121fu5x</bpmn2:outgoing> <bpmn2:outgoing>Flow_121fu5x</bpmn2:outgoing>
</bpmn2:callActivity> </bpmn2:callActivity>
<bpmn2:endEvent id="Event_0pybjkb">
<bpmn2:incoming>Flow_121fu5x</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:intermediateThrowEvent id="Event_0fvzd86" name="Status &#34;Service gestartet&#34; setzen"> <bpmn2:intermediateThrowEvent id="Event_0fvzd86" name="Status &#34;Service gestartet&#34; setzen">
<bpmn2:extensionElements> <bpmn2:extensionElements>
<camunda:inputOutput> <camunda:inputOutput>
@ -563,6 +561,22 @@ Variables.userId(authenticatedUserId)</camunda:script>
<bpmn2:outgoing>Flow_1u7vy0j</bpmn2:outgoing> <bpmn2:outgoing>Flow_1u7vy0j</bpmn2:outgoing>
</bpmn2:callActivity> </bpmn2:callActivity>
<bpmn2:sequenceFlow id="Flow_1u7vy0j" sourceRef="Activity_05mqkaj" targetRef="Event_0fvzd86" /> <bpmn2:sequenceFlow id="Flow_1u7vy0j" sourceRef="Activity_05mqkaj" targetRef="Event_0fvzd86" />
<bpmn2:endEvent id="Event_0pybjkb">
<bpmn2:incoming>Flow_151ouxn</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="Flow_151ouxn" sourceRef="Gateway_0ppveul" targetRef="Event_0pybjkb" />
<bpmn2:sequenceFlow id="Flow_1cpqveb" sourceRef="Gateway_0ppveul" targetRef="Event_10ne4fr" />
<bpmn2:sequenceFlow id="Flow_14pzxys" sourceRef="Event_10ne4fr" targetRef="Event_1ey3eu7" />
<bpmn2:intermediateCatchEvent id="Event_10ne4fr" name="Freigabe für Prozess erhalten">
<bpmn2:incoming>Flow_1cpqveb</bpmn2:incoming>
<bpmn2:outgoing>Flow_14pzxys</bpmn2:outgoing>
<bpmn2:messageEventDefinition id="MessageEventDefinition_0c12q1m" messageRef="Message_15bdtij" />
</bpmn2:intermediateCatchEvent>
<bpmn2:parallelGateway id="Gateway_0ppveul">
<bpmn2:incoming>Flow_121fu5x</bpmn2:incoming>
<bpmn2:outgoing>Flow_151ouxn</bpmn2:outgoing>
<bpmn2:outgoing>Flow_1cpqveb</bpmn2:outgoing>
</bpmn2:parallelGateway>
<bpmn2:textAnnotation id="TextAnnotation_0friy7d"> <bpmn2:textAnnotation id="TextAnnotation_0friy7d">
<bpmn2:text>Shared Service <bpmn2:text>Shared Service
Server bei Hetzner erstellen Server bei Hetzner erstellen
@ -745,7 +759,7 @@ Keycloak Realm mit Administrator Account
<bpmn2:task id="Activity_1trolu7" name="MS-Teams Benachrichtigung erzeugen"> <bpmn2:task id="Activity_1trolu7" name="MS-Teams Benachrichtigung erzeugen">
<bpmn2:extensionElements> <bpmn2:extensionElements>
<camunda:inputOutput> <camunda:inputOutput>
<camunda:outputParameter name="smardigoUrl">https://qa-management-smardigo-01-connect.smardigo.digital/#/process/${contextScopeId}/dossier/${contextProcessDefinitionKey}/${contextProcessId}</camunda:outputParameter> <camunda:outputParameter name="smardigoUrl">https://${cluster.stage}-management-smardigo-01-connect.smardigo.digital/api/redirect/process/${contextScopeId}/dossier/simple-connect/${contextProcessId}</camunda:outputParameter>
<camunda:outputParameter name="section"> <camunda:outputParameter name="section">
<camunda:map> <camunda:map>
<camunda:entry key="activityTitle">${activityTitle}</camunda:entry> <camunda:entry key="activityTitle">${activityTitle}</camunda:entry>
@ -834,18 +848,31 @@ Keycloak Realm mit Administrator Account
<bpmn2:outgoing>Flow_18kjr7f</bpmn2:outgoing> <bpmn2:outgoing>Flow_18kjr7f</bpmn2:outgoing>
</bpmn2:task> </bpmn2:task>
</bpmn2:process> </bpmn2:process>
<bpmn2:message id="Message_15bdtij" name="process-approved-${contextProcessId}" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0oahy0i"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0oahy0i">
<bpmndi:BPMNShape id="Participant_19lpjee_di" bpmnElement="Participant_19lpjee" isHorizontal="true"> <bpmndi:BPMNShape id="Participant_19lpjee_di" bpmnElement="Participant_19lpjee" isHorizontal="true">
<dc:Bounds x="160" y="100" width="4520" height="1870" /> <dc:Bounds x="160" y="100" width="4520" height="1870" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_14pzxys_di" bpmnElement="Flow_14pzxys">
<di:waypoint x="728" y="1230" />
<di:waypoint x="1572" y="1230" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1cpqveb_di" bpmnElement="Flow_1cpqveb">
<di:waypoint x="710" y="875" />
<di:waypoint x="710" y="1212" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_151ouxn_di" bpmnElement="Flow_151ouxn">
<di:waypoint x="685" y="850" />
<di:waypoint x="628" y="850" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1u7vy0j_di" bpmnElement="Flow_1u7vy0j"> <bpmndi:BPMNEdge id="Flow_1u7vy0j_di" bpmnElement="Flow_1u7vy0j">
<di:waypoint x="3260" y="1370" /> <di:waypoint x="3260" y="1370" />
<di:waypoint x="3362" y="1370" /> <di:waypoint x="3362" y="1370" />
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_121fu5x_di" bpmnElement="Flow_121fu5x"> <bpmndi:BPMNEdge id="Flow_121fu5x_di" bpmnElement="Flow_121fu5x">
<di:waypoint x="810" y="850" /> <di:waypoint x="810" y="850" />
<di:waypoint x="728" y="850" /> <di:waypoint x="735" y="850" />
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1ecxnbj_di" bpmnElement="Flow_1ecxnbj"> <bpmndi:BPMNEdge id="Flow_1ecxnbj_di" bpmnElement="Flow_1ecxnbj">
<di:waypoint x="4490" y="1020" /> <di:waypoint x="4490" y="1020" />
@ -1117,6 +1144,9 @@ Keycloak Realm mit Administrator Account
<dc:Bounds x="185" y="285" width="90" height="20" /> <dc:Bounds x="185" y="285" width="90" height="20" />
</bpmndi:BPMNLabel> </bpmndi:BPMNLabel>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_1mpu33m_di" bpmnElement="Gateway_0ppveul">
<dc:Bounds x="685" y="825" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1pzykoz_di" bpmnElement="Activity_1pzykoz" isExpanded="true"> <bpmndi:BPMNShape id="Activity_1pzykoz_di" bpmnElement="Activity_1pzykoz" isExpanded="true">
<dc:Bounds x="770" y="210" width="290" height="200" /> <dc:Bounds x="770" y="210" width="290" height="200" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
@ -1160,7 +1190,7 @@ Keycloak Realm mit Administrator Account
<bpmndi:BPMNShape id="Event_1ey3eu7_di" bpmnElement="Event_1ey3eu7" bioc:stroke="rgb(251, 140, 0)" bioc:fill="rgb(255, 224, 178)"> <bpmndi:BPMNShape id="Event_1ey3eu7_di" bpmnElement="Event_1ey3eu7" bioc:stroke="rgb(251, 140, 0)" bioc:fill="rgb(255, 224, 178)">
<dc:Bounds x="1572" y="1212" width="36" height="36" /> <dc:Bounds x="1572" y="1212" width="36" height="36" />
<bpmndi:BPMNLabel> <bpmndi:BPMNLabel>
<dc:Bounds x="1489" y="1216" width="71" height="40" /> <dc:Bounds x="1614" y="1210" width="71" height="40" />
</bpmndi:BPMNLabel> </bpmndi:BPMNLabel>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_081pcx9_di" bpmnElement="Event_081pcx9"> <bpmndi:BPMNShape id="Event_081pcx9_di" bpmnElement="Event_081pcx9">
@ -1295,9 +1325,6 @@ Keycloak Realm mit Administrator Account
<bpmndi:BPMNShape id="Activity_1ffsvy2_di" bpmnElement="Activity_1ffsvy2" bioc:stroke="rgb(67, 160, 71)" bioc:fill="rgb(200, 230, 201)"> <bpmndi:BPMNShape id="Activity_1ffsvy2_di" bpmnElement="Activity_1ffsvy2" bioc:stroke="rgb(67, 160, 71)" bioc:fill="rgb(200, 230, 201)">
<dc:Bounds x="810" y="810" width="100" height="80" /> <dc:Bounds x="810" y="810" width="100" height="80" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0pybjkb_di" bpmnElement="Event_0pybjkb">
<dc:Bounds x="692" y="832" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0fvzd86_di" bpmnElement="Event_0fvzd86" bioc:stroke="rgb(67, 160, 71)" bioc:fill="rgb(200, 230, 201)"> <bpmndi:BPMNShape id="Event_0fvzd86_di" bpmnElement="Event_0fvzd86" bioc:stroke="rgb(67, 160, 71)" bioc:fill="rgb(200, 230, 201)">
<dc:Bounds x="3362" y="1352" width="36" height="36" /> <dc:Bounds x="3362" y="1352" width="36" height="36" />
<bpmndi:BPMNLabel> <bpmndi:BPMNLabel>
@ -1307,6 +1334,15 @@ Keycloak Realm mit Administrator Account
<bpmndi:BPMNShape id="Activity_05mqkaj_di" bpmnElement="Activity_05mqkaj" bioc:stroke="rgb(67, 160, 71)" bioc:fill="rgb(200, 230, 201)"> <bpmndi:BPMNShape id="Activity_05mqkaj_di" bpmnElement="Activity_05mqkaj" bioc:stroke="rgb(67, 160, 71)" bioc:fill="rgb(200, 230, 201)">
<dc:Bounds x="3160" y="1330" width="100" height="80" /> <dc:Bounds x="3160" y="1330" width="100" height="80" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0pybjkb_di" bpmnElement="Event_0pybjkb">
<dc:Bounds x="592" y="832" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_10ne4fr_di" bpmnElement="Event_10ne4fr">
<dc:Bounds x="692" y="1212" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="673" y="1256" width="83" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="TextAnnotation_0friy7d_di" bpmnElement="TextAnnotation_0friy7d"> <bpmndi:BPMNShape id="TextAnnotation_0friy7d_di" bpmnElement="TextAnnotation_0friy7d">
<dc:Bounds x="2200" y="1470" width="220" height="124" /> <dc:Bounds x="2200" y="1470" width="220" height="124" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>

@ -0,0 +1,5 @@
{
"message": "process-approved-{{ process_instance_id }}",
"localVariables": {},
"processVariables": {}
}
Loading…
Cancel
Save