-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.yaml
More file actions
59 lines (48 loc) · 1.43 KB
/
user.yaml
File metadata and controls
59 lines (48 loc) · 1.43 KB
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
- name: configure user component
hosts: user
become: yes
tasks:
- name: disable default nodejs
ansible.builtin.command: dnf module disable nodejs -y
- name: enable nodejs:20
ansible.builtin.command: dnf module enable nodejs:20 -y
- name: Install nodejs
ansible.builtin.dnf:
name: nodejs
state: present
- name: create roboshop system user
ansible.builtin.user:
name: roboshop
shell: /sbin/nologin
system: true
home: /app
- name: create app directory
ansible.builtin.file:
path: /app
state: directory
- name: download user code
ansible.builtin.get_url:
url: https://roboshop-artifacts.s3.amazonaws.com/user-v3.zip
dest: /tmp/user.zip
# this module thinks file exist on ansible control server, needs to extract on to remote machine
# remote_src: yes means files already exist in user server
- name: extract user code
ansible.builtin.unarchive:
src: /tmp/user.zip
dest: /app
remote_src: yes
- name: install dependencies
community.general.npm:
path: /app
- name: copy user service to system directory
ansible.builtin.copy:
src: user.service
dest: /etc/systemd/system/user.service
- name: systemctl deamon reload
ansible.builtin.systemd_service:
daemon_reload: true
- name: start and enable user
ansible.builtin.service:
name: user
state: started
enabled: yes