Skip to content

Commit

Permalink
Use official API for setting email
Browse files Browse the repository at this point in the history
Using the official API will reduce code in this role.
Furthermore, using an official API remove the need to deploy
dedicated scripts. And such deploy can be annoying depending
on the overall deployment (native, docker, docker-compose, kubernetes).
So, using official API will offer the ability to reuse easier this role
in much more context.
  • Loading branch information
gbonnefille authored and zeitounator committed Dec 16, 2023
1 parent 201a31f commit 7083885
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 45 deletions.
25 changes: 0 additions & 25 deletions files/groovy/setup_email.groovy

This file was deleted.

24 changes: 23 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,29 @@
httpHeader: "{{ nexus_rut_auth_header }}"
when: nexus_rut_auth_header is defined

- include_tasks: setup_email.yml
- name: Configure mail server
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
19 changes: 0 additions & 19 deletions tasks/setup_email.yml

This file was deleted.

0 comments on commit 7083885

Please sign in to comment.