Skip to content

Commit

Permalink
Configure Nexus when on RedHat
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaassssiiee committed Feb 23, 2015
1 parent f6a0909 commit 3ec04c9
Show file tree
Hide file tree
Showing 5 changed files with 608 additions and 1 deletion.
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ nexus_create_os_user: true
nexus_os_user: 'nexus'
nexus_create_os_group: "{{ nexus_create_os_user | bool }}"
nexus_os_group: 'nexus'
nexus_os_user_shell: '/usr/sbin/nologin'
nexus_os_user_shell: '/bin/bash'
10 changes: 10 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
---
# handlers file for ansible-nexus

- name: 'start nexus'
sudo: yes
service: name=nexus state=started
tags:
- init

- name: 'restart nexus'
sudo: yes
service: name=nexus state=restarted
44 changes: 44 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
- name: Update symlink nexus-latest
shell: ln -fs `ls -d {{ nexus_installation_dir }}/nexus-*|tail -1` {{ nexus_installation_dir }}/nexus-latest

- name: Install createrepo for nexus-yum-repository-plugin
yum: name=createrepo state=installed
when: ansible_os_family == "RedHat"

- name: Check if sonatype working directory exists
stat: path="{{ nexus_installation_dir }}/sonatype-work"
register: s_w
Expand All @@ -62,16 +66,56 @@
mode="0755"
recurse=true

- name: Set permissions and ownership on Nexus logs directory
file:
path={{ nexus_installation_dir }}/nexus-latest/logs
owner="{{ nexus_os_user }}"
group="{{ nexus_os_group }}"
state=directory

- name: Set permissions and ownership on Nexus tmp directory
file:
path={{ nexus_installation_dir }}/nexus-latest/tmp
owner="{{ nexus_os_user }}"
group="{{ nexus_os_group }}"
state=directory

- name: Set permissions and ownership on Nexus pid directory
file:
path=/var/run/nexus
owner="{{ nexus_os_user }}"
group="{{ nexus_os_group }}"
state=directory

- name: Configure port in nexus.properties
lineinfile:
dest="{{ nexus_installation_dir }}/nexus-{{ nexus_version }}/conf/nexus.properties"
line="application-port={{ nexus_port }}"
regexp="application-port=.*"
state=present
notify:
- 'restart nexus'

- name: Configure workdir in nexus.properties
lineinfile:
dest="{{ nexus_installation_dir }}/nexus-{{ nexus_version }}/conf/nexus.properties"
line="nexus-work={{ nexus_working_dir }}"
regexp="nexus-work=.*"
state=present
notify:
- 'restart nexus'

- name: Copy the /etc/init.d/nexus file
template: src=init-nexus.j2 dest=/etc/init.d/nexus owner=root group=root mode=0755 backup=yes
when: ansible_os_family == "RedHat"
notify:
- 'start nexus'

- name: Register service with chkconfig system
service: name=nexus enabled=yes
when: ansible_os_family == "RedHat"

- name: Set service start/stop order
sudo: yes
command: chkconfig nexus reset
when: ansible_os_family == "RedHat"
Loading

0 comments on commit 3ec04c9

Please sign in to comment.