Skip to content

Commit a3c9a7f

Browse files
authored
Create demo-open-ports.yaml
1 parent da305de commit a3c9a7f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

ansible/demo-open-ports.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
- name: OPEN PORTS FOR DEMO
3+
hosts: all
4+
become: true
5+
become_method: sudo
6+
7+
vars:
8+
OS_USER: "admin"
9+
KUBECONFIG_PATH: "/home/{{ OS_USER }}/.kube/config"
10+
11+
tasks:
12+
13+
- name: Open ports to 0.0.0.0 (DANGER ONLY FOR DEMOS)
14+
become_user: "{{ OS_USER }}"
15+
ansible.builtin.shell: |
16+
nohup kubectl port-forward --address 0.0.0.0 deployment/producer 5000:5000 > /tmp/kubectl_producer.log 2>&1 &
17+
sleep 1
18+
nohup kubectl port-forward --address 0.0.0.0 deployment/webserver 8080:80 > /tmp/kubectl_webserver.log 2>&1 &
19+
sleep 1
20+
nohup kubectl port-forward --address 0.0.0.0 service/mqtt-rabbitmq 15672:15672 > /tmp/kubectl_rabbitmq.log 2>&1 &
21+
sleep 1
22+
nohup kubectl -n monitoring port-forward --address 0.0.0.0 service/grafana 3000:80 > /tmp/kubectl_grafana.log 2>&1 &
23+
sleep 1
24+
nohup kubectl -n argocd port-forward --address 0.0.0.0 service/argocd-server 8082:80 > /tmp/kubectl_argocd.log 2>&1 &
25+
args:
26+
executable: /bin/bash
27+
28+
- name: Get ArgoCD initial-admin-secret
29+
become_user: "{{ OS_USER }}"
30+
ansible.builtin.shell: |
31+
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
32+
args:
33+
executable: /bin/bash
34+
register: argocd_initial_admin_secret
35+
environment:
36+
37+
- name: Get Grafana password
38+
become_user: "{{ OS_USER }}"
39+
ansible.builtin.shell: |
40+
kubectl -n monitoring get secret monitoring-grafana -o jsonpath="{.data.admin-password}" | base64 -d
41+
args:
42+
executable: /bin/bash
43+
register: grafana_admin_pass
44+
environment:
45+
46+
47+
- name: Show ArgoCD secret (port 8082)
48+
debug:
49+
msg: "ArgoCD admin password: {{ argocd_initial_admin_secret.stdout }}"
50+
51+
- name: Show Grafana secret (port 3000)
52+
debug:
53+
msg: "Grafana admin password: {{ grafana_admin_pass.stdout }}"

0 commit comments

Comments
 (0)