Files
cariflex/iac/ansible/playbook.yml

60 lines
1.6 KiB
YAML

# Cariflex EMS - Ansible Playbook
# Deploys the full Cariflex stack to a target host
---
- name: Deploy Cariflex EMS
hosts: cariflex
become: yes
vars:
cariflex_version: "{{ lookup('env', 'CARIFLEX_VERSION') | default('latest', true) }}"
deploy_env: "{{ lookup('env', 'DEPLOY_ENV') | default('production', true) }}"
pre_tasks:
- name: Check minimum requirements
assert:
that:
- ansible_memtotal_mb >= 4096
- ansible_processor_vcpus >= 2
fail_msg: "Host does not meet minimum requirements (4GB RAM, 2 CPUs)"
roles:
- role: common
tags: [common]
- role: docker
tags: [docker]
- role: traefik
tags: [traefik]
- role: postgresql
tags: [database]
- role: redis
tags: [cache]
- role: flexmeasures
tags: [app]
- role: openadr
tags: [openadr]
- role: grafana
tags: [monitoring]
- role: backup
tags: [backup]
post_tasks:
- name: Verify deployment
uri:
url: "https://{{ cariflex_domain }}/api/v3_0/sensors"
status_code: 200
register: health_check
retries: 10
delay: 5
until: health_check.status == 200
- name: Display deployment info
debug:
msg: |
==========================================
Cariflex EMS Deployed Successfully!
Environment: {{ deploy_env }}
URL: https://{{ cariflex_domain }}
Grafana: https://{{ grafana_domain }}
Version: {{ cariflex_version }}
==========================================