mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-15 08:30:46 +02:00
Added domain validator for web- apps and services for port-ui
This commit is contained in:
parent
7f0d40bdc3
commit
4124e97aeb
@ -1,77 +1,67 @@
|
|||||||
---
|
---
|
||||||
|
- block:
|
||||||
|
- name: "Validate configuration"
|
||||||
|
include_tasks: "validate.yml"
|
||||||
|
|
||||||
- name: "include docker and reverse proxy for '{{ application_id }}'"
|
- name: "include docker and reverse proxy for '{{ application_id }}'"
|
||||||
include_role:
|
include_role:
|
||||||
name: cmp-docker-proxy
|
name: cmp-docker-proxy
|
||||||
when: run_once_docker_portfolio is not defined
|
|
||||||
|
|
||||||
- name: "Check if host-specific config.yaml exists in {{ config_inventory_path }}"
|
- name: "Check if host-specific config.yaml exists in {{ config_inventory_path }}"
|
||||||
stat:
|
stat:
|
||||||
path: "{{ config_inventory_path }}"
|
path: "{{ config_inventory_path }}"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
become: false
|
become: false
|
||||||
register: config_file
|
register: config_file
|
||||||
when: run_once_docker_portfolio is not defined
|
|
||||||
|
|
||||||
- name: Load menu categories
|
- name: Load menu categories
|
||||||
include_vars:
|
include_vars:
|
||||||
file: "menu_categories.yml"
|
file: "menu_categories.yml"
|
||||||
when: run_once_docker_portfolio is not defined
|
|
||||||
|
|
||||||
- name: Load docker cards
|
- name: Load docker cards
|
||||||
set_fact:
|
set_fact:
|
||||||
portfolio_cards: "{{ lookup('docker_cards', 'roles') }}"
|
portfolio_cards: "{{ lookup('docker_cards', 'roles') }}"
|
||||||
when: run_once_docker_portfolio is not defined
|
|
||||||
|
|
||||||
- name: "Load images for applications feature simpleicons is enabled "
|
- name: "Load images for applications feature simpleicons is enabled "
|
||||||
set_fact:
|
set_fact:
|
||||||
portfolio_cards: "{{ portfolio_cards | add_simpleicon_source(domains, WEB_PROTOCOL) }}"
|
portfolio_cards: "{{ portfolio_cards | add_simpleicon_source(domains, WEB_PROTOCOL) }}"
|
||||||
when:
|
when:
|
||||||
- (applications | get_app_conf(application_id, 'features.simpleicons', False))
|
- (applications | get_app_conf(application_id, 'features.simpleicons', False))
|
||||||
- run_once_docker_portfolio is not defined
|
|
||||||
|
|
||||||
- name: Group docker cards
|
- name: Group docker cards
|
||||||
set_fact:
|
set_fact:
|
||||||
portfolio_menu_data: "{{ lookup('docker_cards_grouped', portfolio_cards, portfolio_menu_categories) }}"
|
portfolio_menu_data: "{{ lookup('docker_cards_grouped', portfolio_cards, portfolio_menu_categories) }}"
|
||||||
when: run_once_docker_portfolio is not defined
|
|
||||||
|
|
||||||
- name: Debug portfolio data
|
- name: Debug portfolio data
|
||||||
debug:
|
debug:
|
||||||
msg:
|
msg:
|
||||||
portfolio_cards: "{{ portfolio_cards }}"
|
portfolio_cards: "{{ portfolio_cards }}"
|
||||||
portfolio_menu_categories: "{{ portfolio_menu_categories}}"
|
portfolio_menu_categories: "{{ portfolio_menu_categories}}"
|
||||||
portfolio_menu_data: "{{ portfolio_menu_data }}"
|
portfolio_menu_data: "{{ portfolio_menu_data }}"
|
||||||
service_provider: "{{ service_provider }}"
|
service_provider: "{{ service_provider }}"
|
||||||
when:
|
when: enable_debug | bool
|
||||||
- enable_debug | bool
|
|
||||||
- run_once_docker_portfolio is not defined
|
|
||||||
|
|
||||||
- name: Copy host-specific config.yaml if it exists
|
- name: Copy host-specific config.yaml if it exists
|
||||||
template:
|
template:
|
||||||
src: "{{ config_inventory_path }}"
|
src: "{{ config_inventory_path }}"
|
||||||
dest: "{{docker_repository_path}}/app/config.yaml"
|
dest: "{{docker_repository_path}}/app/config.yaml"
|
||||||
notify: docker compose up
|
notify: docker compose up
|
||||||
when:
|
when: config_file.stat.exists
|
||||||
- run_once_docker_portfolio is not defined
|
|
||||||
- config_file.stat.exists
|
|
||||||
|
|
||||||
- name: Copy default config.yaml from the role template if host-specific file does not exist
|
- name: Copy default config.yaml from the role template if host-specific file does not exist
|
||||||
template:
|
template:
|
||||||
src: "config.yaml.j2"
|
src: "config.yaml.j2"
|
||||||
dest: "{{docker_repository_path}}/app/config.yaml"
|
dest: "{{docker_repository_path}}/app/config.yaml"
|
||||||
notify: docker compose up
|
notify: docker compose up
|
||||||
when:
|
when: not config_file.stat.exists
|
||||||
- run_once_docker_portfolio is not defined
|
|
||||||
- not config_file.stat.exists
|
|
||||||
|
|
||||||
- name: add docker-compose.yml
|
- name: add docker-compose.yml
|
||||||
template:
|
template:
|
||||||
src: docker-compose.yml.j2
|
src: docker-compose.yml.j2
|
||||||
dest: "{docker_compose.directories.instance}}docker-compose.yml"
|
dest: "{docker_compose.directories.instance}}docker-compose.yml"
|
||||||
notify: docker compose up
|
notify: docker compose up
|
||||||
when: run_once_docker_portfolio is not defined
|
|
||||||
|
- name: run the portfolio tasks once
|
||||||
- name: run the portfolio tasks once
|
set_fact:
|
||||||
set_fact:
|
run_once_docker_portfolio: true
|
||||||
run_once_docker_portfolio: true
|
|
||||||
when: run_once_docker_portfolio is not defined
|
when: run_once_docker_portfolio is not defined
|
18
roles/web-app-port-ui/tasks/validate.yml
Normal file
18
roles/web-app-port-ui/tasks/validate.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
- name: Assert that each web-app- or web-svc- port-ui-desktop app uses the correct domain suffix
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- >
|
||||||
|
(
|
||||||
|
not (item.value.features['port-ui-desktop'] | default(false) | bool)
|
||||||
|
)
|
||||||
|
or (domains | get_domain(item.key)).endswith(domains | get_domain('web-app-port-ui'))
|
||||||
|
fail_msg: >
|
||||||
|
Application {{ item.key }}
|
||||||
|
has domain {{ domains | get_domain(item.key) }}
|
||||||
|
but it does not end with {{ domains | get_domain('web-app-port-ui') }}!
|
||||||
|
loop: "{{ applications
|
||||||
|
| dict2items
|
||||||
|
| selectattr('key', 'match', '^(web-app-|web-svc-)')
|
||||||
|
| list }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.key }}"
|
Loading…
x
Reference in New Issue
Block a user