ansible-role-eom/tasks/www.yaml
2024-08-08 11:04:51 -04:00

68 lines
1.6 KiB
YAML

---
# tasks file for www
- name: Create a config map for www
vars:
httpd_server_name: "www.eom.dev"
httpd_conf_extra:
- httpd-auth.conf
- httpd-ssi.conf
k8s:
state: present
api_version: v1
kind: ConfigMap
name: www
namespace: "eom-{{ target_namespace }}"
definition:
data:
httpd.conf: "{{ lookup('template', 'httpd.conf.j2') }}"
httpd-auth.conf: "{{ lookup('template', 'httpd-auth.conf.j2') }}"
httpd-ssi.conf: "{{ lookup('file', 'httpd-ssi.conf') }}"
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: www
image: ericomeehan/www
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