forked from jhinrichsen/ansible-nexus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jochen Hinrichsen
committed
Nov 17, 2014
1 parent
c7cfece
commit 8cc3355
Showing
8 changed files
with
123 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,46 @@ | ||
ansible-nexus | ||
============= | ||
Role Name | ||
========= | ||
|
||
Ansible playbook to install Sonatype Nexus (free edition) | ||
Ansible Sonatype Nexus role. Completely independent from any package manager. | ||
Does not require root or sudo permission to run. | ||
|
||
TODO | ||
---- | ||
- Add datadir (plus entry nexus-work={{datadir}} in conf/nexus.properties | ||
- Change default admin account (admin/admin123) | ||
|
||
|
||
|
||
Role Variables | ||
-------------- | ||
|
||
- **nexus_download_dir**: download path on the control machine that will be used. Defaults to *'/tmp'* | ||
- **nexus_version**: Nexus version to be installed. Defaults to *'latest'* | ||
- **nexus_installation_dir**: installation prefix that will be used on installation hosts. Defaults to *'/usr/share'* | ||
- **nexus_work_dir**: working directory, aka sonatype-work | ||
- **nexus_port**: TCP port | ||
|
||
Dependencies | ||
------------ | ||
|
||
wget (on host, not on clients) | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: | ||
|
||
- hosts: servers | ||
roles: | ||
- { role: jhinrichsen.nexus, nexus_installation_dir: '/opt' } | ||
|
||
License | ||
------- | ||
|
||
MIT | ||
|
||
Author Information | ||
------------------ | ||
|
||
This playbook is heavily inspired by Alexander Ramos Jardim. | ||
Any errors are probably my fault. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
# defaults file for ansible-nexus | ||
nexus_download_dir: '/tmp' | ||
# nexus_package: 'nexus-2.10.0-02-bundle.tar.gz' | ||
nexus_package: 'nexus-latest-bundle.tar.gz' | ||
nexus_version: 'latest' | ||
nexus_installation_dir: '/usr/share' | ||
nexus_working_dir: '/var/nexus' | ||
nexus_port: 9999 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# handlers file for ansible-nexus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
galaxy_info: | ||
author: Jochen Hinrichsen | ||
description: Sonatype Nexus playbook | ||
license: MIT | ||
min_ansible_version: 1.6 | ||
platforms: | ||
- name: GenericLinux | ||
versions: | ||
- all | ||
- any | ||
categories: | ||
- system | ||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
|
||
- hosts: dev | ||
roles: | ||
- { role: jhinrichsen.nexus, | ||
nexus_version: '2.10.0-02', | ||
sudo: yes} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
# tasks file for ansible-nexus | ||
- name: download Nexus to host | ||
local_action: > | ||
command wget -N -P "{{nexus_download_dir}}" http://download.sonatype.com/nexus/oss/{{nexus_package}} | ||
tags: download | ||
sudo: no | ||
|
||
- name: "{{nexus_installation_dir}} must exist" | ||
file: | ||
path="{{nexus_installation_dir}}" | ||
state="directory" | ||
|
||
- name: Unpacks Nexus download | ||
unarchive: | ||
src="{{nexus_download_dir}}/{{nexus_package}}" | ||
dest="{{nexus_installation_dir}}" | ||
creates="{{nexus_installation_dir}}/nexus-{{nexus_version}}/bin/nexus" | ||
force=no | ||
tags: unpack | ||
|
||
- name: Move sonatype working directory into place (1/2) | ||
stat: path="{{nexus_installation_dir}}/sonatype-work" | ||
register: s_w | ||
|
||
- name: Move sonatype working directory into place (2/2) | ||
command: mv "{{nexus_installation_dir}}/sonatype-work" "{{nexus_working_dir}}" | ||
when: s_w.stat.exists | ||
|
||
- name: Configure port | ||
lineinfile: | ||
dest="{{nexus_installation_dir}}/nexus-{{nexus_version}}/conf/nexus.properties" | ||
line="application-port={{nexus_port}}" | ||
regexp="application-port=.*" | ||
state=present | ||
|
||
- name: Configure workdir | ||
lineinfile: | ||
dest="{{nexus_installation_dir}}/nexus-{{nexus_version}}/conf/nexus.properties" | ||
line="nexus-work={{nexus_working_dir}}" | ||
regexp="nexus-work=.*" | ||
state=present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# vars file for ansible-nexus |