Skip to content

Commit 21237c8

Browse files
authored
Merge pull request ansible-ThoTeam#6 from remyma/feature-configure-properties
Feature configure properties
2 parents 1d9154f + 4db4dbc commit 21237c8

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

defaults/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ nexus_data_dir: '/var/nexus'
99
nexus_timezone: 'UTC' # java timezone
1010
nexus_tmp_dir: '/tmp/nexus'
1111

12+
# Nexus default properties
13+
nexus_default_port: 8081
14+
nexus_default_context_path: '/'
15+
1216
nexus_admin_password: 'changeme' # Note : admin password change subsequent to first-time install is *not implemented* yet
1317
nexus_anonymous_access: false
1418

tasks/call_script.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Calling Groovy script {{ script_name }}
33
uri:
4-
url: "http://localhost:8081/service/siesta/rest/v1/script/{{ script_name }}/run"
4+
url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}service/siesta/rest/v1/script/{{ script_name }}/run"
55
user: 'admin'
66
password: "{{ current_nexus_admin_password }}"
77
headers:

tasks/declare_script_each.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Removing (potential) previously declared Groovy script {{ item }}
33
uri:
4-
url: "http://localhost:8081/service/siesta/rest/v1/script/{{ item }}"
4+
url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}service/siesta/rest/v1/script/{{ item }}"
55
user: 'admin'
66
password: "{{ current_nexus_admin_password }}"
77
method: DELETE
@@ -10,7 +10,7 @@
1010

1111
- name: Declaring Groovy script {{ item }}
1212
uri:
13-
url: "http://localhost:8081/service/siesta/rest/v1/script"
13+
url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}service/siesta/rest/v1/script"
1414
user: 'admin'
1515
password: "{{ current_nexus_admin_password }}"
1616
body_format: json

tasks/nexus_install.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@
114114
- name: Set nexus user
115115
lineinfile: dest="{{ nexus_installation_dir }}/nexus-latest/bin/nexus.rc" regexp=".*run_as_user=.*" line="run_as_user=\"{{ nexus_os_user }}\""
116116

117+
- name: Set nexus port
118+
lineinfile:
119+
dest: "{{ nexus_default_settings_file }}"
120+
regexp: "^application-port=.*"
121+
line: "application-port={{ nexus_default_port }}"
122+
123+
- name: Set nexus context path
124+
lineinfile:
125+
dest: "{{ nexus_default_settings_file }}"
126+
regexp: "^nexus-context-path=.*"
127+
line: "nexus-context-path={{ nexus_default_context_path }}"
128+
117129
- name: Bind nexus service to 127.0.0.1 only
118130
lineinfile:
119131
dest: "{{ nexus_default_settings_file }}"
@@ -153,7 +165,7 @@
153165
timeout: 1800
154166

155167
- name: Waiting for nexus to be ready...
156-
wait_for: port=8081 delay=5
168+
wait_for: port={{ nexus_default_port }} delay=5
157169

158170
- name: Chown configuration files from {{ nexus_installation_dir }}/nexus-latest/etc back to root
159171
file:

templates/nexus-vhost.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
RewriteEngine on
1616
RewriteRule ^/content/([^/]+)/(.*) /repository/$2 [R=301,L]
1717

18-
ProxyPass / http://localhost:8081/
19-
ProxyPassReverse / http://localhost:8081/
18+
ProxyPass / http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}
19+
ProxyPassReverse / http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}
2020
RequestHeader set X-Forwarded-Proto "https"
2121

2222
ErrorLog /var/log/httpd/{{ public_hostname }}_nexus_error.log

0 commit comments

Comments
 (0)