142
142
- name: ANSIBLE_BECOME_METHOD
143
143
vars:
144
144
- name: ansible_become_method
145
+ platform_type:
146
+ description:
147
+ - Set type of platform.
148
+ env:
149
+ - name: ANSIBLE_PLATFORM_TYPE
150
+ vars:
151
+ - name: ansible_platform_type
145
152
"""
146
153
147
154
from io import BytesIO
@@ -169,10 +176,14 @@ def __init__(self, play_context, new_stdin, *args, **kwargs):
169
176
)
170
177
171
178
self ._auth = None
172
-
173
179
if self ._network_os :
180
+ self .load_platform_plugins (self ._network_os )
181
+
182
+ def load_platform_plugins (self , platform_type = None ):
183
+ platform_type = platform_type or self .get_option ("platform_type" )
174
184
175
- self .httpapi = httpapi_loader .get (self ._network_os , self )
185
+ if platform_type :
186
+ self .httpapi = httpapi_loader .get (platform_type , self )
176
187
if self .httpapi :
177
188
self ._sub_plugin = {
178
189
"type" : "httpapi" ,
@@ -181,25 +192,25 @@ def __init__(self, play_context, new_stdin, *args, **kwargs):
181
192
}
182
193
self .queue_message (
183
194
"vvvv" ,
184
- "loaded API plugin %s from path %s for network_os %s"
195
+ "loaded API plugin %s from path %s for platform type %s"
185
196
% (
186
197
self .httpapi ._load_name ,
187
198
self .httpapi ._original_path ,
188
- self . _network_os ,
199
+ platform_type ,
189
200
),
190
201
)
191
202
else :
192
203
raise AnsibleConnectionFailure (
193
- "unable to load API plugin for network_os %s"
194
- % self . _network_os
204
+ "unable to load API plugin for platform type %s"
205
+ % platform_type
195
206
)
196
207
197
208
else :
198
209
raise AnsibleConnectionFailure (
199
- "Unable to automatically determine host network os . Please "
200
- "manually configure ansible_network_os value for this host"
210
+ "Unable to automatically determine host platform type . Please "
211
+ "manually configure platform_type value for this host"
201
212
)
202
- self .queue_message ("log" , "network_os is set to %s" % self . _network_os )
213
+ self .queue_message ("log" , "platform_type is set to %s" % platform_type )
203
214
204
215
@property
205
216
def _url (self ):
0 commit comments