44
44
List of cluster node members, where a priority can be given to each node. A resource bound to a group will run on the available nodes with the
45
45
highest priority. If there are more nodes in the highest priority class, the services will get distributed to those nodes. The priorities have a
46
46
relative meaning only. The higher the number, the higher the priority.
47
+ It can either be a string C(node_name:priority,node_name:priority) or an actual list of strings.
47
48
required: false
48
- type: str
49
+ type: list
50
+ elements: str
49
51
nofailback:
50
52
description: |
51
53
The CRM tries to run services on the node with the highest priority. If a node with higher priority comes online, the CRM migrates the service to
@@ -118,7 +120,7 @@ def _delete(self, name):
118
120
def create (self , groups , name , comment , nodes , nofailback , restricted ):
119
121
data = {
120
122
"comment" : comment ,
121
- "nodes" : nodes ,
123
+ "nodes" : "," . join ( nodes ) ,
122
124
"nofailback" : int (nofailback ),
123
125
"restricted" : int (restricted )
124
126
}
@@ -127,6 +129,10 @@ def create(self, groups, name, comment, nodes, nofailback, restricted):
127
129
if group ["group" ] != name :
128
130
continue
129
131
132
+ group ["nodes" ] = sorted (
133
+ group .get ("nodes" , "" ).split ("," )
134
+ )
135
+
130
136
if (
131
137
group .get ("comment" , "" ),
132
138
group .get ("nodes" , "" ),
@@ -139,6 +145,7 @@ def create(self, groups, name, comment, nodes, nofailback, restricted):
139
145
return True
140
146
141
147
self ._post (group = name , ** data )
148
+ return True
142
149
143
150
def delete (self , groups , name ):
144
151
for group in groups :
@@ -157,7 +164,7 @@ def run_module():
157
164
state = dict (choices = ['present' , 'absent' ], required = True ),
158
165
name = dict (type = 'str' , required = True ),
159
166
comment = dict (type = 'str' , required = False ),
160
- nodes = dict (type = 'str' , required = False ),
167
+ nodes = dict (type = 'list' , elements = ' str' , required = False ),
161
168
nofailback = dict (type = 'bool' , default = False ),
162
169
restricted = dict (type = 'bool' , default = False ),
163
170
)
@@ -177,7 +184,7 @@ def run_module():
177
184
178
185
name = module .params ['name' ]
179
186
comment = module .params ['comment' ]
180
- nodes = module .params ['nodes' ]
187
+ nodes = sorted ( module .params ['nodes' ])
181
188
nofailback = module .params ['nofailback' ]
182
189
restricted = module .params ['restricted' ]
183
190
try :
0 commit comments