Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup mail configuration #33

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,12 @@ see `defaults/main.yml` for these options:

These are all false unless you override them from playbook / group_var / cli, these all utilize the same mechanism as maven.

the variable ```nexus_mail_host``` is used to configure the mail server. If empty, the mail server is left disabled.
Others variables are :
``` nexus_mail_port, nexus_mail_from, nexus_mail_subject_prefix, nexus_mail_username, nexus_mail_password, nexus_mail_start_tls_enabled, nexus_mail_start_tls_required, nexus_mail_ssl_on_connect_enabled, nexus_mail_ssl_check_server_identity_enabled, nexus_mail_trust_store_enabled ```



## Dependencies

This role requires Ansible 2.1 or higher.
Expand Down
13 changes: 13 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,16 @@ _nexus_repos_gitlfs_defaults:
nexus_repos_gitlfs_hosted:
- name: gitlfs-internal
blob_store: "{{ nexus_blob_names.gitlfs.blob }}"

nexus_mail_host: "localhost"
nexus_mail_port: 25
nexus_mail_from: "nexus-no-reply@localhost"
nexus_mail_subject_prefix: "[NEXUS]"
nexus_mail_username: ""
nexus_mail_password: ""
nexus_mail_start_tls_enabled: false
nexus_mail_start_tls_required: false
nexus_mail_ssl_on_connect_enabled: false
nexus_mail_ssl_check_server_identity_enabled: false
nexus_mail_trust_store_enabled: false

12 changes: 12 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,15 @@

- include: create_task_each.yml
with_items: "{{ nexus_scheduled_tasks }}"

- name: Configure mail server
include: setup_mail.yml
when: nexus_mail_host is defined

- include: call_script.yml
vars:
script_name: add_ldapuser_role
args:
ldap_id: "{{ nexus_ldap_id }}"
role: "{{ nexus_role }}"
usernames: "{{ nexus_ldapadmin_username }}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why LDAP related info for seting up mail parameters?

13 changes: 13 additions & 0 deletions tasks/setup_mail.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- name: Running setup_mail.yml
uri:
url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}service/extdirect"
user: 'admin'
password: "{{ current_nexus_admin_password }}"
body_format: json
headers:
Content-Type: "application/json"
method: POST
status_code: 200,204
force_basic_auth: yes
body: {"action":"coreui_Email","method":"update","data":[{"enabled":true,"host":"{{ nexus_mail_host }}","port": "{{ nexus_mail_port }}","username":"{{ nexus_mail_username }}","password":"{{ nexus_mail_password }}","fromAddress":"{{ nexus_mail_from }}","subjectPrefix":"{{ nexus_mail_subject_prefix}}" ,"startTlsEnabled":"{{ nexus_mail_start_tls_enabled }}","startTlsRequired":"{{ nexus_mail_start_tls_required }}","sslOnConnectEnabled":"{{ nexus_mail_ssl_on_connect_enabled }}","sslCheckServerIdentityEnabled":"{{ nexus_mail_ssl_check_server_identity_enabled }}","nexusTrustStoreEnabled":"{{ nexus_mail_trust_store_enabled }}"}],"type":"rpc","tid":12}