-
Notifications
You must be signed in to change notification settings - Fork 1
/
init_server.yml
109 lines (97 loc) · 2.47 KB
/
init_server.yml
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
101
102
103
104
105
106
107
---
- name: init server env
gather_facts: no
hosts: "{{ init_node }}"
become: yes
become_method: sudo
tags:
- init_chain_node
tasks:
- name: install docker and pip
apt:
name:
- docker.io
- python3-pip
- python-apt
- git
update_cache: yes
#ignore_errors: yes
- pip:
name:
- docker-compose
- docker
- ansible
executable: pip3
- name: config docker repo
shell: curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
- name: enable & restart docker
service:
name: docker
enabled: yes
state: restarted
- name: install build server depend docker and git
gather_facts: no
hosts: muta_build
become: yes
become_method: sudo
tags:
- init_build_node
tasks:
- name: install docker and git
apt:
name:
- docker.io
- git
update_cache: yes
- name: install py env
hosts: localhost
become: yes
become_method: sudo
tags:
- init_localhost_node
tasks:
- name: install pip3 git
apt:
name:
- python3-pip
- git
update_cache: yes
- pip:
name:
- toml
executable: pip3
- name: install nodejs
hosts: benchmark
become: yes
become_method: sudo
tags:
- init_benchmark_node
vars:
NODEJS_VERSION: "12"
ansible_distribution_release: "xenial" #trusty
tasks:
- name: Install the gpg key for nodejs LTS
apt_key:
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
state: present
- name: Install the nodejs LTS repos
apt_repository:
repo: "deb https://deb.nodesource.com/node_{{ NODEJS_VERSION }}.x {{ ansible_distribution_release }} main"
state: present
update_cache: yes
- name: Install the nodejs
apt:
name: nodejs
state: present
- name: install supervisor
pip:
name:
- supervisor
executable: pip3
- name: mkdir supervisor dir
file: path=/etc/supervisor/ state=directory mode=0755 recurse=yes
- name: config supervisor
shell: echo_supervisord_conf > /etc/supervisord.conf && sed -i "s/\;\[include\]/\[include\]/" /etc/supervisord.conf && echo "files = /etc/supervisor/*.conf" >> /etc/supervisord.conf
- name: run supervisord
shell: supervisord
ignore_errors: yes