Skip to content

Commit

Permalink
Use email api to setup nexus email capabilities (ansible-ThoTeam#398)
Browse files Browse the repository at this point in the history
Use official API for setting email instead of groovy script

Fixes ansible-ThoTeam#252
Fixes ansible-ThoTeam#282
---------

Co-authored-by: Guilhem Bonnefille <[email protected]>
  • Loading branch information
zeitounator and gbonnefille authored Dec 16, 2023
1 parent 358e505 commit 36d656a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 41 deletions.
25 changes: 0 additions & 25 deletions files/groovy/setup_email.groovy

This file was deleted.

38 changes: 22 additions & 16 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,28 @@
when: nexus_rut_auth_header is defined

- name: Configure mail server
ansible.builtin.include_tasks: call_script.yml
vars:
script_name: setup_email
call_args:
email_server_enabled: "{{ nexus_email_server_enabled }}"
email_server_host: "{{ nexus_email_server_host }}"
email_server_port: "{{ nexus_email_server_port }}"
email_server_username: "{{ nexus_email_server_username }}"
email_server_password: "{{ nexus_email_server_password }}"
email_from_address: "{{ nexus_email_from_address }}"
email_subject_prefix: "{{ nexus_email_subject_prefix }}"
email_tls_enabled: "{{ nexus_email_tls_enabled }}"
email_tls_required: "{{ nexus_email_tls_required }}"
email_ssl_on_connect_enabled: "{{ nexus_email_ssl_on_connect_enabled }}"
email_ssl_check_server_identity_enabled: "{{ nexus_email_ssl_check_server_identity_enabled }}"
email_trust_store_enabled: "{{ nexus_email_trust_store_enabled }}"
ansible.builtin.uri:
url: "{{ nexus_api_scheme }}://{{ nexus_api_hostname }}:{{ nexus_api_port }}{{ nexus_api_context_path }}service/rest/v1/email"
user: admin
password: "{{ current_nexus_admin_password }}"
method: PUT
force_basic_auth: true
validate_certs: "{{ nexus_api_validate_certs }}"
body_format: json
body:
enabled: "{{ nexus_email_server_enabled }}"
host: "{{ nexus_email_server_host }}"
port: "{{ nexus_email_server_port }}"
username: "{{ nexus_email_server_username }}"
password: "{{ nexus_email_server_password }}"
fromAddress: "{{ nexus_email_from_address }}"
subjectPrefix: "{{ nexus_email_subject_prefix }}"
startTlsEnabled: "{{ nexus_email_tls_enabled }}"
startTlsRequired: "{{ nexus_email_tls_required }}"
sslOnConnectEnabled: "{{ nexus_email_ssl_on_connect_enabled }}"
sslServerIdentityCheckEnabled: "{{ nexus_email_ssl_check_server_identity_enabled }}"
nexusTrustStoreEnabled: "{{ nexus_email_trust_store_enabled }}"
status_code: 200,204

- name: Configure branding capability
ansible.builtin.include_tasks: call_script.yml
Expand Down

0 comments on commit 36d656a

Please sign in to comment.