Module: Appforce::Spawn

Included in:
Basement
Defined in:
lib/appforce/spawn.rb,
lib/appforce/spawn/runner.rb,
lib/appforce/spawn/version.rb,
lib/appforce/spawn/api/call.rb,
lib/appforce/spawn/template.rb,
lib/appforce/spawn/exceptions.rb

Defined Under Namespace

Modules: API, Api, ClassMethods Classes: Basement, ConfigFileParseError, Error, MissingDependency, MissingFile, MissingParameters, NotYetImplemented, Runner, Template, UnknownClient

Constant Summary collapse

MAJOR =
0
MINOR =
5
SUB =
1
VERSION =

must always be d.d.d format

[MAJOR, MINOR, SUB].join('.')

Class Method Summary collapse

Class Method Details

.ansible_ping(*args) ⇒ Object



268
269
270
# File 'lib/appforce/spawn.rb', line 268

def self.ansible_ping(*args)
  Basement.ansible_ping
end

.available_actionsObject



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/appforce/spawn.rb', line 159

def self.available_actions
  {
    'clients' => {
      info: "Retrieve a complete list of Clients",
      cmd:  :clients
    },
    'generate' => {
      info: "Build out the Ansible template for a Client (client API name is required)",
      cmd:  :generate
    },
    'client:hosts' => {
      info: "Retrieve a Hosts file for a Client (client API name is required)",
      cmd:  :get_hosts
    },
    'client:hosts:details' => {
      info: "Display all details about Client Hosts (client API name is required)",
      cmd:  :get_all_host_data
    },
    'client:users:active' => {
      info: "Retrieve an Active Users file for a Client (client API name is required)",
      cmd:  :get_active_users
    },
    'client:users:inactive' => {
      info: "Retrieve an Inactive Users file for a Client (client API name is required)",
      cmd:  :get_inactive_users
    },
    'client:vars' => {
      info: "Retrieve a Vars file for a Client (client API name is required)",
      cmd:  :get_vars
    },
    'ping' => {
      info: "Test connection to host and API access",
      cmd:  :ping
    },
    'ping:host' => {
      info: "Test if API is available",
      cmd:  :ping_host
    },
    'ping:api' => {
      info: "Test if you have access to the API",
      cmd:  :ping_api
    },
    'spawn' => {
      info: "Run Ansible Playbook to spawn users to Client hosts",
      cmd:  :spawn
    },
    'spawn:ready?' => {
      info: "Check to see if you have the required ansible version and roles installed",
      cmd:  :check_dependencies
    },
    'spawn:command' => {
      info: "Display Ansible command to run Playbook for a Client",
      cmd:  :display_ansible_command
    },
    'spawn:ping' => {
      info: "Ansible ping Client hosts in the 'hosts' file",
      cmd:  :ansible_ping
    },
    'spawn:ping:command' => {
      info: "Display ansible ping command",
      cmd:  :display_ansible_ping_command
    },
    'ssh' => {
      info: "Select a Host to ssh in as your User name (client API name is required)",
      cmd:  :ssh_to_host
    },
  }
end

.check_dependencies(*args) ⇒ Object



288
289
290
# File 'lib/appforce/spawn.rb', line 288

def self.check_dependencies(*args)
  Basement.check_dependencies(*args)
end

.clients(*args) ⇒ Object



228
229
230
# File 'lib/appforce/spawn.rb', line 228

def self.clients(*args)
  Basement.clients
end

.config(*args) ⇒ Object



155
156
157
# File 'lib/appforce/spawn.rb', line 155

def self.config(*args)
  Basement.config
end

.display_ansible_command(*args) ⇒ Object



264
265
266
# File 'lib/appforce/spawn.rb', line 264

def self.display_ansible_command(*args)
  Basement.display_ansible_command
end

.display_ansible_ping_command(*args) ⇒ Object



272
273
274
# File 'lib/appforce/spawn.rb', line 272

def self.display_ansible_ping_command(*args)
  Basement.display_ansible_ping_command
end

.dump_example_config(*args) ⇒ Object



276
277
278
# File 'lib/appforce/spawn.rb', line 276

def self.dump_example_config(*args)
  Basement.dump_example_config(*args)
end


147
148
149
# File 'lib/appforce/spawn.rb', line 147

def self.footer
  Basement.footer
end

.generate(*args) ⇒ Object



256
257
258
# File 'lib/appforce/spawn.rb', line 256

def self.generate(*args)
  Basement.generate(*args)
end

.get_active_users(*args) ⇒ Object



240
241
242
# File 'lib/appforce/spawn.rb', line 240

def self.get_active_users(*args)
  Basement.get_active_users(*args)
end

.get_all_host_data(*args) ⇒ Object



252
253
254
# File 'lib/appforce/spawn.rb', line 252

def self.get_all_host_data(*args)
  Basement.get_all_host_data(*args)
end

.get_clients(*args) ⇒ Object



232
233
234
# File 'lib/appforce/spawn.rb', line 232

def self.get_clients(*args)
  Basement.get_clients
end

.get_hosts(*args) ⇒ Object



236
237
238
# File 'lib/appforce/spawn.rb', line 236

def self.get_hosts(*args)
  Basement.get_hosts(*args)
end

.get_inactive_users(*args) ⇒ Object



244
245
246
# File 'lib/appforce/spawn.rb', line 244

def self.get_inactive_users(*args)
  Basement.get_inactive_users(*args)
end

.get_vars(*args) ⇒ Object



248
249
250
# File 'lib/appforce/spawn.rb', line 248

def self.get_vars(*args)
  Basement.get_vars(*args)
end

.header(input) ⇒ Object



143
144
145
# File 'lib/appforce/spawn.rb', line 143

def self.header(input)
  Basement.header(input)
end

.included(base) ⇒ Object

Extend module base class Allows fo r class like interactions on Module



17
18
19
# File 'lib/appforce/spawn.rb', line 17

def self.included(base)
  base.extend ClassMethods
end

.latest_version(*args) ⇒ Object



284
285
286
# File 'lib/appforce/spawn.rb', line 284

def self.latest_version(*args)
  Basement.latest_version(*args)
end

.load_config(*args, &block) ⇒ Object



151
152
153
# File 'lib/appforce/spawn.rb', line 151

def self.load_config(*args, &block)
  Basement.load_config(*args, &block)
end

.loggerObject



135
136
137
# File 'lib/appforce/spawn.rb', line 135

def self.logger
  Basement.logger
end

.logger=(logger) ⇒ Object



139
140
141
# File 'lib/appforce/spawn.rb', line 139

def self.logger=(logger)
  Basement.logger = logger
end

.ping(*args) ⇒ Object



292
293
294
295
296
297
298
299
# File 'lib/appforce/spawn.rb', line 292

def self.ping(*args)
  host = Basement.ping_host
  api  = Basement.ping_api
  {
    :host => { :code => host.code, :body => host.body },
    :api  => { :code => api.code, :body => api.body }
  }
end

.ping_api(*args) ⇒ Object



306
307
308
309
# File 'lib/appforce/spawn.rb', line 306

def self.ping_api(*args)
  api = Basement.ping_api
  { :code => api.code, :body => api.body }
end

.ping_host(*args) ⇒ Object



301
302
303
304
# File 'lib/appforce/spawn.rb', line 301

def self.ping_host(*args)
  host = Basement.ping_host
  { :code => host.code, :body => host.body }
end

.spawn(*args) ⇒ Object



260
261
262
# File 'lib/appforce/spawn.rb', line 260

def self.spawn(*args)
  Basement.spawn
end

.ssh_to_host(*args) ⇒ Object



280
281
282
# File 'lib/appforce/spawn.rb', line 280

def self.ssh_to_host(*args)
  Basement.ssh_to_host(*args)
end