-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
installNexusServer.yaml
67 lines (67 loc) · 1.75 KB
/
installNexusServer.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
- hosts: nexusservers
become: true
gather_facts: no
tasks:
- name: Install Java 1.8
yum:
name: java-1.8.0-openjdk
state: present
- name: Download nexus software
get_url:
url: https://download.sonatype.com/nexus/3/nexus-3.43.0-01-unix.tar.gz
dest: /opt/
- name: Extract Nexus Software
unarchive:
src: /opt/nexus-3.43.0-01-unix.tar.gz
dest: /opt/
remote_src: yes
- name: Rename the nexus directory
shell:
mv /opt/nexus-3.43.0-01 /opt/nexus/
- name: Create the nexus user
user:
name: nexus
create_home: true
shell: /bin/bash
comment: "Nexus Management Account"
expires: -1
password: "{{ 'nexus' | password_hash('sha512','A512') }}"
- name: Setup Sudo Access for nexus User
copy:
dest: /etc/sudoers.d/nexus
content: 'nexus ALL=(ALL) NOPASSWD: ALL'
validate: /usr/sbin/visudo -cf %s
- name: Change owner and group and permissions to /opt/nexus/
file:
path: /opt/nexus/
owner: nexus
group: nexus
mode: 0775
recurse: yes
state: directory
- name: Change owner and group and permissions to /opt/sonatype-work
file:
path: /opt/sonatype-work/
group: nexus
owner: nexus
mode: 0775
recurse: yes
state: directory
- name: Set the run_as_user parameter in nexus.rc
lineinfile:
dest: /opt/nexus/bin/nexus.rc
regexp: "#run_as_user="
line: "run_as_user=nexus"
backrefs: true
- name: Create soft link for nexus
file:
src: /opt/nexus/bin/nexus
dest: /etc/init.d/nexus
state: link
- name: Start nexus service
systemd:
name: nexus
state: started
daemon_reload: yes
enabled: yes
...