-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshipping.yaml
More file actions
100 lines (83 loc) Β· 2.14 KB
/
shipping.yaml
File metadata and controls
100 lines (83 loc) Β· 2.14 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
- name: configure shipping component
hosts: shipping
become: yes
tasks:
- name: install maven and mysql
ansible.builtin.dnf:
name: "{{ item }}"
state: installed
loop:
- maven
- mysql
- name: install PyMySQL and cryptography
ansible.builtin.pip:
name: "{{ item }}"
executable: pip3.9
loop:
- cryptography
- PyMySQL
- name: create app directory
ansible.builtin.file:
path: /app
state: directory
- name: create roboshop system user
ansible.builtin.user:
name: roboshop
shell: /sbin/nologin
system: true
home: /app
- name: download shipping code
ansible.builtin.get_url:
url: https://roboshop-artifacts.s3.amazonaws.com/shipping-v3.zip
dest: /tmp/shipping.zip
- name: extract shipping code
ansible.builtin.unarchive:
src: /tmp/shipping.zip
dest: /app
remote_src: yes
- name: install maven dependencies
ansible.builtin.command: mvn clean package
args:
chdir: /app
- name: rename jar file
ansible.builtin.command: mv target/shipping-1.0.jar shipping.jar
args:
chdir: /app
- name: copy shipping service
ansible.builtin.copy:
src: shipping.service
dest: /etc/systemd/system/shipping.service
- name: daemon reload
ansible.builtin.systemd_service:
daemon_reload: true
- name: enable and start shipping
ansible.builtin.service:
name: shipping
state: started
enabled: yes
# - name: connect to mysql using app user
# community.mysql.mysql_info:
# login_user: shipping
# login_password: RoboShop@1
# login_host: mysql.srivenkata.shop
# login_db: cities
- name: import data
tags:
- import
community.mysql.mysql_db:
name: all
login_user: root
login_password: RoboShop@1
login_host: mysql.srivenkata.shop
state: import
target: "{{ item }}"
loop:
- /app/db/schema.sql
- /app/db/app-user.sql
- /app/db/master-data.sql
- name: restart shipping
tags:
- import
ansible.builtin.service:
state: restarted
name: shipping