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

61 lines
1.4 KiB
YAML

---
# tasks file for www
- name: Create a config map for www
k8s:
state: present
api_version: v1
kind: ConfigMap
name: www
namespace: "eom-{{ target_namespace }}"
definition:
data:
httpd.conf: "{{ lookup('template', 'www-httpd.conf.j2') }}"
mime.types: "{{ lookup('file', 'mime.types') }}"
- name: Create a deployment
k8s:
definition:
apiVersion: v1
kind: Deployment
metadata:
name: www
namespace: "eom-{{ target_namespace }}"
spec:
replicas: 1
selector:
matchLabels:
app: www
template:
metadata:
labels:
app: www
spec:
containers:
- name: httpd
image: httpd
volumeMounts:
- name: config
mountPath: /usr/local/apache2/conf
ports:
- containerPort: 80
volumes:
- name: config
configMap:
name: www
- name: Expose deployment as a service
k8s:
definition:
apiVersion: v1
kind: Service
metadata:
name: www
namespace: "eom-{{ target_namespace }}"
spec:
selector:
app: www
ports:
- port: 80
name: www-80
type: ClusterIP