Browse Source

simple automatic tests added

merge-requests/1/merge
Christoph Haas 6 years ago
parent
commit
538128db0a
2 changed files with 40 additions and 0 deletions
  1. +1
    -0
      ansible/ispmail.yml
  2. +39
    -0
      ansible/roles/ispmail-tests/tasks/main.yml

+ 1
- 0
ansible/ispmail.yml View File

@@ -20,3 +20,4 @@
# - ispmail-dovecot
# - ispmail-webmail
# - ispmail-webmail-apache
- ispmail-tests

+ 39
- 0
ansible/roles/ispmail-tests/tasks/main.yml View File

@@ -0,0 +1,39 @@
---
- name: Remove all mails from john@example.org mailbox
file:
path: /var/vmail/example.org/john
state: absent

- name: Check that all required TCP ports are responding
wait_for:
host: localhost
port: "{{ item }}"
state: started # Port should be open
delay: 0 # No wait before first check (sec)
timeout: 3 # Stop checking after timeout (sec)
ignore_errors: yes
with_items:
- 443
- 80
- 143
- 110
- 25
- 587

- name: Try sending an email to Postfix over SMTP
mail:
host: localhost
port: 25
to: John Smith <john@example.org>
subject: Ansible Test SMTP
body: System {{ ansible_hostname }} has been successfully provisioned.

- name: Try sending an email to Postfix over Submission port
mail:
host: localhost
username: john@example.org
password: summersun
port: 587
to: John Smith <john@example.org>
subject: Ansible Test Submission
body: System {{ ansible_hostname }} has been successfully provisioned.

Loading…
Cancel
Save