-
Notifications
You must be signed in to change notification settings - Fork 5
/
run.yml
125 lines (112 loc) · 4.29 KB
/
run.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
- name: RHOAS test
hosts: localhost
gather_facts: false
connection: local
tasks:
- name: Create kafka
rhoas.rhoas.create_kafka:
name: "unique-kafka-name"
cloud_provider: "aws"
region: "us-east-1"
plan: "developer.x1"
billing_model: "standard"
# billing_cloud_account_id: "billing_cloud_account_id"
# openshift_offline_token: "OFFLINE_TOKEN"
register:
kafka_req_resp_obj
- name: Debug create kafka
debug:
msg: "{{ kafka_req_resp_obj['kafka_id'] }}"
- name: Create Service Account
rhoas.rhoas.create_service_account:
name: "jeeves"
description: "jeeves service account"
# openshift_offline_token: "OFFLINE_TOKEN"
no_log: True
register:
srvce_acc_resp_obj
- name: Create kafka ACL Service Binding
rhoas.rhoas.create_kafka_acl_binding:
# dynamically get the kafka id from the kafka_req_resp
kafka_id: "{{ kafka_req_resp_obj['kafka_id'] }}"
# to hardcode the kafka_id uncomment and use the following line
# kafka_id: "KAFKA_ID"
# dynamically get the service account id from the srvce_acc_resp_obj
principal: " {{ srvce_acc_resp_obj['client_id'] }}"
# to hardcode the principal_id uncomment and use the following line
# principal: "PRINCIPAL_ID"
# These keys must have values to be passed for the successful execution of the task
resource_name: "topic_name"
resource_type: "Topic"
pattern_type: "PREFIXED"
operation_type: "all"
permission_type: "allow"
# openshift_offline_token: "OFFLINE_TOKEN"
# passing the kafka_admin_url from the kafka_req_resp_obj is more efficient as one less API call is made
# kafka_admin_url: "https://kafka-admin.dev.struttin.com"
- name: Create Kafka Topic
rhoas.rhoas.create_kafka_topic:
topic_name: "topic_one"
kafka_id: "{{ kafka_req_resp_obj['kafka_id'] }}"
# to hardcode the kafka_id uncomment and use the following line
# kafka_id: "KAFKA_ID"
# openshift_offline_token: "OFFLINE_TOKEN"
partitions: 1
retention_period_ms: "86400666"
retention_size_bytes: "1073741824"
cleanup_policy: "compact"
register:
kafka_topic_resp_obj
- name: Create Kafka Topic2
rhoas.rhoas.create_kafka_topic:
topic_name: "topic_two"
kafka_id: "{{ kafka_req_resp_obj['kafka_id'] }}"
# to hardcode the kafka_id uncomment and use the following line
# kafka_id: "KAFKA_ID"
# openshift_offline_token: "OFFLINE_TOKEN"
partitions: 1
register:
kafka_topic_resp_obj2
- name: Update Kakfa topic1
rhoas.rhoas.update_kafka_topic:
topic_name: "topic_one"
kafka_id: "{{ kafka_req_resp_obj['kafka_id'] }}"
# to hardcode the kafka_id uncomment and use the following line
# kafka_id: "KAFKA_ID"
# openshift_offline_token: "OFFLINE_TOKEN"
partitions: 1
## this will update the cleanup_policy from compact to delete
cleanup_policy: "delete"
## some other parameters that can be updated
# retention_period_ms: "86400666"
# retention_size_bytes: "1073741824"
register:
kafka_topic_resp_obj
- name: Debug update kafka topic
debug:
msg: "{{ kafka_topic_resp_obj }}"
- name: Delete kafka topic_one
rhoas.rhoas.delete_kafka_topic:
topic_name: "topic_one"
kafka_id: "{{ kafka_req_resp_obj['kafka_id'] }}"
# to hardcode the kafka_id uncomment and use the following line
# kafka_id: "KAFKA_ID"
# openshift_offline_token: "OFFLINE_TOKEN"
- name: Delete kafka topic_two
rhoas.rhoas.delete_kafka_topic:
topic_name: "topic_two"
kafka_id: "{{ kafka_req_resp_obj['kafka_id'] }}"
# to hardcode the kafka_id uncomment and use the following line
# kafka_id: "KAFKA_ID"
# openshift_offline_token: "OFFLINE_TOKEN"
- name: Delete Service Account
rhoas.rhoas.delete_service_account_by_id:
# service_account_id: "service_account_id"
service_account_id: "{{ srvce_acc_resp_obj['client_id'] }}"
# openshift_offline_token: "OFFLINE_TOKEN"
- name: Delete kafka
rhoas.rhoas.delete_kafka_by_id:
kafka_id: "{{ kafka_req_resp_obj['kafka_id'] }}"
# to hardcode the kafka_id uncomment and use the following line
# openshift_offline_token: "OFFLINE_TOKEN"