Skip to content

Commit 535c72a

Browse files
committed
Merge ansible
1 parent 89f77f4 commit 535c72a

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

workshop/ansible/orbstack.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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: /blue_rabbit.followed
21+
register: wh_result
22+
23+
- name: Add environment variables to .profile
24+
ansible.builtin.blockinfile:
25+
path: /etc/skel/.profile
26+
block: |
27+
export REALM={{ realm }}
28+
export ACCESS_TOKEN={{ ingest_token }}
29+
export RUM_TOKEN={{ rum_token }}
30+
export HEC_TOKEN={{ hec_token }}
31+
export HEC_URL={{ hec_url }}
32+
export INSTANCE={{ instance }}
33+
become: true
34+
when: not wh_result.stat.exists
35+
36+
- name: Create K8s secrets YAML
37+
file:
38+
path: /home/splunk/workshop-secrets.yaml
39+
owner: splunk
40+
group: splunk
41+
state: touch
42+
become: true
43+
when: not wh_result.stat.exists
44+
45+
- name: Update secrets YAML
46+
ansible.builtin.blockinfile:
47+
path: /home/splunk/workshop-secrets.yaml
48+
block: |
49+
apiVersion: v1
50+
kind: Secret
51+
metadata:
52+
name: workshop-secret
53+
namespace: default
54+
type: Opaque
55+
stringData:
56+
app: {{ instance }}-store
57+
deployment: "deployment.environment={{ instance }}"
58+
env: {{ instance }}
59+
instance: {{ instance }}
60+
realm: {{ realm }}
61+
rum_token: {{ rum_token }}
62+
hec_token: {{ hec_token }}
63+
hec_url: {{ hec_url }}
64+
become: true
65+
when: not wh_result.stat.exists
66+
67+
- name: Apply secrets YAML
68+
command: kubectl apply -f workshop-secrets.yaml
69+
when: not wh_result.stat.exists
70+
71+
- name: Create a file to signify that the config has run successfully
72+
file:
73+
path: "/blue_rabbit.followed"
74+
state: touch
75+
become: true
76+
when: not wh_result.stat.exists

0 commit comments

Comments
 (0)