1+ ---
2+ - hosts : localhost
3+ gather_facts : false
4+
5+ pre_tasks :
6+ - name : Set the required variables
7+ set_fact :
8+ ingest_token : " {{ lookup('env','ACCESS_TOKEN') }}"
9+ rum_token : " {{ lookup('env','RUM_TOKEN') }}"
10+ realm : " {{ lookup('env','REALM') }}"
11+ instance : " {{ lookup('env','INSTANCE') }}"
12+ hec_url : " {{ lookup('env','HEC_URL') }}"
13+ hec_token : " {{ lookup('env','HEC_TOKEN') }}"
14+
15+ tasks :
16+ - name : Configure Orbstack
17+ block :
18+ - name : Check to see if the config has run
19+ stat :
20+ path : /orange_rabbit.followed
21+ register : wh_result
22+
23+ - name : Create K3s secrets YAML
24+ file :
25+ path : /home/splunk/splunk-k8s-secrets.yaml
26+ owner : splunk
27+ group : splunk
28+ state : touch
29+ become : true
30+ when : not wh_result.stat.exists
31+
32+ - name : Update secrets YAML
33+ ansible.builtin.blockinfile :
34+ path : /home/splunk/splunk-k8s-secrets.yaml
35+ block : |
36+ apiVersion: v1
37+ kind: Secret
38+ metadata:
39+ name: workshop-secret
40+ namespace: default
41+ type: Opaque
42+ stringData:
43+ app: {{ instance }}
44+ env: {{ instance }}-workshop
45+ deployment: "deployment.environment={{ instance }}"
46+ instance: {{ instance }}
47+ realm: {{ realm }}
48+ rum_token: {{ rum_token }}
49+ hec_token: {{ hec_token }}
50+ hec_url: {{ hec_url }}
51+ become : true
52+ when : not wh_result.stat.exists
53+
54+ - name : Apply secrets YAML
55+ command : kubectl apply -f splunk-k8s-secrets.yaml
56+ when : not wh_result.stat.exists
57+
58+ - name : Create a file to signify that the config has run successfully
59+ file :
60+ path : " /orange_rabbit.followed"
61+ state : touch
62+ become : true
63+ when : not wh_result.stat.exists
0 commit comments