96 lines
3.4 KiB
YAML
96 lines
3.4 KiB
YAML
---
|
|
- name: Verify roundcube role
|
|
hosts: localhost
|
|
gather_facts: false
|
|
vars:
|
|
roundcube_data_dir: /tmp/sovereign_test/roundcube
|
|
|
|
tasks:
|
|
- name: Check roundcube data directory exists
|
|
ansible.builtin.stat:
|
|
path: /tmp/sovereign_test/roundcube
|
|
register: data_dir_stat
|
|
|
|
- name: Assert roundcube data directory is present
|
|
ansible.builtin.assert:
|
|
that: data_dir_stat.stat.isdir
|
|
fail_msg: "Data directory /tmp/sovereign_test/roundcube was not created"
|
|
|
|
- name: Check roundcube config directory exists
|
|
ansible.builtin.stat:
|
|
path: /tmp/sovereign_test/roundcube/config
|
|
register: config_dir_stat
|
|
|
|
- name: Assert roundcube config directory is present
|
|
ansible.builtin.assert:
|
|
that: config_dir_stat.stat.isdir
|
|
fail_msg: "Directory /tmp/sovereign_test/roundcube/config was not created"
|
|
|
|
- name: Check custom.inc.php exists
|
|
ansible.builtin.stat:
|
|
path: /tmp/sovereign_test/roundcube/config/custom.inc.php
|
|
register: custom_php_stat
|
|
|
|
- name: Assert custom.inc.php is present
|
|
ansible.builtin.assert:
|
|
that: custom_php_stat.stat.exists
|
|
fail_msg: "custom.inc.php was not rendered for roundcube"
|
|
|
|
- name: Read custom.inc.php
|
|
ansible.builtin.slurp:
|
|
src: /tmp/sovereign_test/roundcube/config/custom.inc.php
|
|
register: custom_php_raw
|
|
|
|
- name: Set custom.inc.php content fact
|
|
ansible.builtin.set_fact:
|
|
custom_php: "{{ custom_php_raw.content | b64decode }}"
|
|
|
|
- name: Assert tenant branding in custom.inc.php
|
|
ansible.builtin.assert:
|
|
that: "'Test Corp Webmail' in custom_php"
|
|
fail_msg: "Expected 'Test Corp Webmail' not found in custom.inc.php"
|
|
|
|
- name: Check docker-compose.yml exists
|
|
ansible.builtin.stat:
|
|
path: /tmp/sovereign_test/roundcube/docker-compose.yml
|
|
register: compose_stat
|
|
|
|
- name: Assert docker-compose.yml was rendered
|
|
ansible.builtin.assert:
|
|
that: compose_stat.stat.exists
|
|
fail_msg: "docker-compose.yml was not rendered for roundcube"
|
|
|
|
- name: Read docker-compose.yml
|
|
ansible.builtin.slurp:
|
|
src: /tmp/sovereign_test/roundcube/docker-compose.yml
|
|
register: compose_raw
|
|
|
|
- name: Set compose content fact
|
|
ansible.builtin.set_fact:
|
|
compose: "{{ compose_raw.content | b64decode }}"
|
|
|
|
- name: Assert roundcube image reference in compose
|
|
ansible.builtin.assert:
|
|
that: "'roundcube/roundcubemail' in compose"
|
|
fail_msg: "Expected image 'roundcube/roundcubemail' not found in docker-compose.yml"
|
|
|
|
- name: Assert roundcube host rule in compose
|
|
ansible.builtin.assert:
|
|
that: "'Host(`webmail.test.example.com`)' in compose"
|
|
fail_msg: "Expected Host rule for webmail.test.example.com not found in docker-compose.yml"
|
|
|
|
- name: Assert GELF logging address in compose
|
|
ansible.builtin.assert:
|
|
that: "'udp://127.0.0.1:12201' in compose"
|
|
fail_msg: "Expected GELF address udp://127.0.0.1:12201 not found in docker-compose.yml"
|
|
|
|
- name: Assert sovereign network is external in compose
|
|
ansible.builtin.assert:
|
|
that: "'external: true' in compose"
|
|
fail_msg: "Expected 'external: true' not found in docker-compose.yml"
|
|
|
|
- name: Assert roundcube skin (elastic) in compose
|
|
ansible.builtin.assert:
|
|
that: "'elastic' in compose"
|
|
fail_msg: "Expected roundcube skin 'elastic' not found in docker-compose.yml"
|