-
Notifications
You must be signed in to change notification settings - Fork 1
/
S_ANSIBLE_01.yaml
54 lines (44 loc) · 1.06 KB
/
S_ANSIBLE_01.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
---
- hosts: all
remote_user: ubuntu
become: yes
tasks:
- name: Update apt repositories cache
apt:
update_cache: yes
- name: Install a list of packages
apt:
pkg:
- wget
- java-1.8.0-openjdk
- name: Create user nexus
user:
name: nexus
state: presemt
- name: Create a directory if it does not exist
file:
path: /app
state: directory
owner: "nexus"
group: "nexus"
- name: go into app directory
command: "cd /app"
- name: Download nexus
get_url:
url: https://download.sonatype.com/nexus/3/latest-unix.tar.gz
dest: nexus.tar.gz
- name: Extract nexus.tar.gz
unarchive:
src: nexus.tar.gz
dest: nexus
- name: Uncomment run_as_user
ansible.builtin.lineinfile:
path: /app/nexus/bin/nexus.rc
regexp: '^run_as_user="nexus"'
line: run_as_user="nexus"
- name: Register service with chkconfig system
service: name=nexus enabled=yes
- name: Start service nexus
service:
name: nexus
state: started