This repository was archived by the owner on Feb 13, 2025. It is now read-only.
File tree 4 files changed +22
-20
lines changed
4 files changed +22
-20
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "python.pythonPath" : " /usr/bin/python3"
2
+ "python.pythonPath" : " C:\\ Python27\\ python.exe" ,
3
+ "python.linting.pylintEnabled" : false
3
4
}
Original file line number Diff line number Diff line change 1
1
import socket
2
+ # define hostname
2
3
hostname = socket .gethostname ()
3
- if 'k8s' in hostname :
4
- def k8s_grain ():
5
- grains = {}
6
- grains [role ] = 'master'
7
- if '01' in hostname :
8
- role = 'master'
9
- else :
10
- role = 'worker'
11
- k8s = {'role' : role , 'cluster' : 'k8spi' }
12
- return k8s
13
- print (k8s )
14
-
15
- else :
16
- print ("Not a k8s node, no cluster for you" )
17
-
18
4
5
+ # If hostname contains "k8s" assign the role "master" for 01, else "worker".
6
+ def get_k8s_name ():
7
+ k8s_role_dict = {'k8s role' : '' }
8
+ if 'k8s' in hostname :
9
+ if '01' in hostname :
10
+ k8s_role_dict ['k8s role' ] = 'master'
11
+ else :
12
+ k8s_role_dict ['k8s role' ] = 'worker'
13
+ return k8s_role_dict
Original file line number Diff line number Diff line change 5
5
"data_dir" : " /opt/consul" ,
6
6
"bind_addr" : " 192.168.2.13" ,
7
7
"client_addr" : " 192.168.2.13" ,
8
- "ui" : true
8
+ "ui" : true ,
9
+ "raft_protocol" : " 3"
9
10
}
Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ consul:
54
54
55
55
copy consul config :
56
56
file.managed :
57
- - name:
58
- - source: salt:// {{slspath }}/files/consul.service
59
- - mode: 644
57
+ - name: /etc/consul.d/config.json
58
+ - source: salt:// {{slspath }}/files/config.json
59
+ - mode: 644
60
+ - makedirs: True
61
+ - user: consul
62
+ - group: consul
63
+ - require:
64
+ - user: consul user
You can’t perform that action at this time.
0 commit comments