-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.yaml
76 lines (60 loc) · 1.86 KB
/
user.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
68
69
70
71
72
73
74
75
76
- name: creating user
hosts: user
become: yes
tasks:
- name: disableing old nodejs ebnable new nodejs
ansible.builtin.shell: dnf module disable nodejs -y ; dnf module enable nodejs:18 -y
- name: Install NodeJS
ansible.builtin.dnf:
name: nodejs
state: present
- name: create roboshop user
ansible.builtin.user:
name: roboshop
- name: creating app directory
ansible.builtin.file:
path: /app
state: directory
- name: Download the application
ansible.builtin.get_url:
url: https://roboshop-builds.s3.amazonaws.com/user.zip
dest: /tmp
- name: unzipping
ansible.builtin.unarchive:
src: /tmp/user.zip
dest: /app
remote_src: yes
- name: Install dependencies
ansible.builtin.command: npm install
args:
chdir: /app
- name: copy user service
ansible.builtin.copy:
src: user.service
dest: /etc/systemd/system/user.service
- name: demon reload
ansible.builtin.systemd_service:
daemon_reload: true
#let start data entery after reload
- name: copy mongodb repo
ansible.builtin.copy:
src: mongo.repo
dest: /etc/yum.repos.d/mongo.repo
- name: Install MongoDB client
ansible.builtin.package:
name: mongodb-org-shell
state: present
- name: get the catageories count
ansible.builtin.command: mongo --host mongodb.bigmatrix.in --quiet --eval 'db = db.getSiblingDB("user"); db.user.count()'
register: user_count
# - name: print the count
# ansible.builtin.debug:
# msg: "product count : {{product_count}}"
- name: load cataloge data
ansible.builtin.command: mongo --host mongodb.bigmatrix.in < /app/schema/user.js
when: user_count.stdout == "0"
- name: start and enable user
ansible.builtin.service:
name: user
enabled: yes
state: started