infra-role-alertmanager/tasks/container.yml

37 lines
1.7 KiB
YAML

---
- name: Create app compose file
template:
src: 'docker-compose.yml.j2'
dest: '{{ alertmanager_compose_file }}'
owner: 'dockremap'
group: 'docker'
mode: 0640
- name: Create OAuth compose file
include_role: name=infra-role-oauth-proxy
vars:
oauth_service_name: '{{ alertmanager_service_name }}-oauth'
oauth_service_path: '{{ alertmanager_service_path }}'
oauth_compose_path: '{{ alertmanager_oauth_compose_file }}'
oauth_provider: '{{ alertmanager_oauth_provider | mandatory }}'
oauth_domain: '{{ alertmanager_domain | mandatory }}'
oauth_github_org: '{{ alertmanager_oauth_gh_org }}'
oauth_github_teams: '{{ alertmanager_oauth_gh_teams }}'
oauth_keycloak_realm: '{{ alertmanager_oauth_keycloak_realm }}'
oauth_keycloak_groups: '{{ alertmanager_oauth_keycloak_groups }}'
oauth_keycloak_roles: '{{ alertmanager_oauth_keycloak_roles }}'
oauth_id: '{{ alertmanager_oauth_id | mandatory }}'
oauth_secret: '{{ alertmanager_oauth_secret | mandatory }}'
oauth_cookie_secret: '{{ alertmanager_oauth_cookie_secret | mandatory }}'
oauth_local_port: '{{ alertmanager_oauth_cont_port | mandatory }}'
oauth_local_addr: '0.0.0.0'
oauth_upstream_url: 'http://app:{{ alertmanager_webui_port }}/'
- name: Create containers
community.docker.docker_compose_v2:
project_src: '{{ alertmanager_service_path }}'
files: ['{{ alertmanager_compose_file }}', '{{ alertmanager_oauth_compose_file }}']
recreate: '{{ compose_recreate }}'
pull: '{{ compose_pull }}'
state: '{{ "restarted" if alertmanager_config.changed else compose_state }}'