summaryrefslogtreecommitdiff
path: root/parcels/roles/dependencies/check-env/tasks/check_env.yml
blob: 7f57b13e7aa841f574440ff1d2401b231d98e137 (plain)
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
- name: check firewall
  shell: systemctl status firewalld | grep Active | grep dead | wc -l
  ignore_errors: false
  register: firewall_out 

- name: stop firewall
  shell: systemctl stop firewalld && systemctl disable firewalld
  ignore_errors: false
  when: firewall_out.stdout != '1'

- name: has stopped, check the firewall again
  shell: systemctl status firewalld | grep Active | grep dead | wc -l
  ignore_errors: false
  register: firewall_again

- name: To terminate execution
  fail:
    msg: "执行防火墙关闭命令后无效,请检查"
  when: firewall_again.stdout != '1'

- name: check jdk 1.8_73
  shell: source /etc/profile && java -version 2>&1 | grep 1.8.0_73 | wc -l
  ignore_errors: false 
  register: jdk_out  #定义变量存储返回的结果

- name: To terminate execution
  fail:
    msg: "JDK 未安装 请检查"
  when: jdk_out.stdout != '2'

- name: check timezone
  shell: "cat /etc/timezone | wc -l"
  ignore_errors: false
  register: timezone_out  #定义变量存储返回的结果

- name: To terminate execution
  fail:
    msg: "/etc/timezone 未配置 请检查"
  when: timezone_out.stdout != '1'

#- name: set timezone
#  shell: cp /usr/share/zoneinfo/{{ time_zone }} /etc/localtime |cat && echo {{ time_zone }} > /etc/timezone
#  when: timezone_out.stdout != '1'
#
#- name: check timezone again
#  shell: cat /etc/timezone | wc -l
#  ignore_errors: false
#  register: timezone_again  #定义变量存储返回的结果
#
#- name: To terminate execution
#  fail:
#    msg: "服务器timezone文件为空,请检查"
#  when: timezone_again.stdout != '1'

#- name: check CPU support sse4_2
#  shell: lscpu |grep "sse4_2" |wc -l
#  ignore_errors: false
#  register: cpu_out  #定义变量存储返回的结果
#
#- name: To terminate execution
#  fail:
#    msg: "服务器CPU不支持 sse4_2 指令集,无法安装clickhouse组件"
#  when: cpu_out.stdout != '1'

#- debug:
#    msg: " the enviroment is correct"
#  when: firewall_out.stdout == '1' and jdk_out.stdout == '2' and timezone_out.stdout == '1'