ansible-role-eom/tasks/proxy.yaml
2024-07-29 15:17:26 -04:00

72 lines
1.8 KiB
YAML

---
# tasks file for deploy-reverse-proxy.yml
- name: Create ConfigMap for httpd
k8s:
state: present
api_version: v1
kind: ConfigMap
name: proxy
namespace: "eom-{{ target_namespace }}"
definition:
data:
httpd.conf: "{{ lookup('file', 'proxy-httpd.conf') }}"
httpd-proxy.conf: "{{ lookup('file', 'httpd-proxy.conf') }}"
httpd-ssl.conf: "{{ lookup('file', 'httpd-ssl.conf') }}"
mime.types: "{{ lookup('file', 'mime.types') }}"
server.crt: "{{ proxy_server_crt }}"
server.key: "{{ proxy_server_key }}"
- name: Create a deployment
k8s:
definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: proxy
namespace: "eom-{{ target_namespace }}"
spec:
replicas: 1
selector:
matchLabels:
app: proxy
template:
metadata:
labels:
app: proxy
spec:
containers:
- name: proxy
image: httpd
volumeMounts:
- name: config
mountPath: /usr/local/apache2/conf
ports:
- containerPort: 80
- containerPort: 443
volumes:
- name: config
configMap:
name: proxy
- name: Expose deployment as a service
k8s:
definition:
apiVersion: v1
kind: Service
metadata:
name: proxy
namespace: "eom-{{ target_namespace }}"
spec:
selector:
app: proxy
ports:
- port: 80
protocol: TCP
nodePort: 30080
name: proxy-80
- port: 443
protocol: TCP
nodePort: 30443
name: proxy-443
type: NodePort