summaryrefslogtreecommitdiff
path: root/ansible_tools/roles/set-zextras-custom-login-page
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_tools/roles/set-zextras-custom-login-page')
-rw-r--r--ansible_tools/roles/set-zextras-custom-login-page/tasks/check_param.yml63
-rw-r--r--ansible_tools/roles/set-zextras-custom-login-page/tasks/main.yml11
2 files changed, 74 insertions, 0 deletions
diff --git a/ansible_tools/roles/set-zextras-custom-login-page/tasks/check_param.yml b/ansible_tools/roles/set-zextras-custom-login-page/tasks/check_param.yml
new file mode 100644
index 0000000..b8a0893
--- /dev/null
+++ b/ansible_tools/roles/set-zextras-custom-login-page/tasks/check_param.yml
@@ -0,0 +1,63 @@
+---
+- name: Check input variable
+ ansible.builtin.fail:
+ msg: |
+ la variable zimbraMailDomain est obligatoire pour
+ utiliser le role set-logo.
+ Veuillez la rajouter dans les host_vars
+ when:
+ - zimbraMailDomain is not defined
+
+- name: Check param - zmprov gd zimbraPublicServiceHostname
+ ansible.builtin.shell: |
+ set -e -o pipefail
+ /opt/zimbra/bin/zmprov gd {{ zimbraMailDomain }} zimbraPublicServiceHostname | sed -n 2p | awk '{print $2}'
+ register: zps_hostname
+ changed_when: false
+ args:
+ executable: /bin/bash
+
+- name: Stop run if zimbraPublicServiceHostname param not set
+ ansible.builtin.fail:
+ msg: |
+ Veuillez d'abord renseigner
+ la configuration zimbraPublicServiceHostname
+ du domaine {{ zimbraMailDomain }}
+ when:
+ - zps_hostname.stdout == ""
+
+- name: Check param - zmprov gd zimbraPublicServiceProtocol
+ ansible.builtin.shell: |
+ set -e -o pipefail
+ /opt/zimbra/bin/zmprov gd {{ zimbraMailDomain }} zimbraPublicServiceProtocol | sed -n 2p | awk '{print $2}'
+ register: zps_protocol
+ changed_when: false
+ args:
+ executable: /bin/bash
+
+- name: Stop run if zimbraPublicServiceProtocol param not set
+ ansible.builtin.fail:
+ msg: |
+ Veuillez d'abord renseigner
+ la configuration zimbraPublicServiceProtocol
+ du domaine {{ zimbraMailDomain }}
+ when:
+ - zps_protocol.stdout == ""
+
+- name: Check param - zmprov gd zimbraPublicServicePort
+ ansible.builtin.shell: |
+ set -e -o pipefail
+ /opt/zimbra/bin/zmprov gd {{ zimbraMailDomain }} zimbraPublicServicePort | sed -n 2p | awk '{print $2}'
+ register: zps_port
+ changed_when: false
+ args:
+ executable: /bin/bash
+
+- name: Stop run if zimbraPublicServicePort param not set
+ ansible.builtin.fail:
+ msg: |
+ Veuillez d'abord renseigner
+ la configuration zimbraPublicServicePort
+ du domaine {{ zimbraMailDomain }}
+ when:
+ - zps_port.stdout == ""
diff --git a/ansible_tools/roles/set-zextras-custom-login-page/tasks/main.yml b/ansible_tools/roles/set-zextras-custom-login-page/tasks/main.yml
new file mode 100644
index 0000000..4a7968c
--- /dev/null
+++ b/ansible_tools/roles/set-zextras-custom-login-page/tasks/main.yml
@@ -0,0 +1,11 @@
+---
+- name: Check required parameters
+ include_tasks: check_param.yml
+
+- name: Set zextras login page
+ ansible.builtin.command: "/opt/zimbra/bin/zmprov
+ md {{ zimbraMailDomain }} \
+ zimbraAuthMech custom:zx \
+ zimbraWebClientLoginURL /zx/login/page/?domain={{ zimbraMailDomain }} \
+ zimbraWebClientLogoutURL /zx/auth/logout/"
+ changed_when: true