├── .gitignore
├── Automate
├── Infrastructure
│ ├── VM
│ │ ├── Provisioning
│ │ │ ├── StateMachines
│ │ │ │ ├── Methods.class
│ │ │ │ │ ├── __class__.yaml
│ │ │ │ │ └── __methods__
│ │ │ │ │ │ ├── redhat_customizerequest.rb
│ │ │ │ │ │ └── redhat_customizerequest.yaml
│ │ │ │ ├── VMProvision_VM.class
│ │ │ │ │ ├── __class__.yaml
│ │ │ │ │ └── template.yaml
│ │ │ │ └── __namespace__.yaml
│ │ │ └── __namespace__.yaml
│ │ └── __namespace__.yaml
│ └── __namespace__.yaml
├── Integration
│ ├── ConfigurationManagement
│ │ ├── Cobbler.class
│ │ │ ├── __class__.yaml
│ │ │ ├── __methods__
│ │ │ │ ├── create_cobbler_record.rb
│ │ │ │ └── create_cobbler_record.yaml
│ │ │ └── create_cobbler_record.yaml
│ │ ├── Foreman.class
│ │ │ ├── __class__.yaml
│ │ │ ├── __methods__
│ │ │ │ ├── register_foreman.rb
│ │ │ │ └── register_foreman.yaml
│ │ │ └── register_foreman.yaml
│ │ └── __namespace__.yaml
│ ├── RHEV
│ │ ├── __namespace__.yaml
│ │ ├── reconfigure_vm.class
│ │ │ ├── __class__.yaml
│ │ │ ├── __methods__
│ │ │ │ ├── dialog_add_disk.rb
│ │ │ │ ├── dialog_add_disk.yaml
│ │ │ │ ├── dialog_add_nic.rb
│ │ │ │ ├── dialog_add_nic.yaml
│ │ │ │ ├── hot_add_disk.rb
│ │ │ │ ├── hot_add_disk.yaml
│ │ │ │ ├── hot_add_nic.rb
│ │ │ │ └── hot_add_nic.yaml
│ │ │ ├── dialog_add_disk.yaml
│ │ │ ├── dialog_add_nic.yaml
│ │ │ ├── hot_add_disk.yaml
│ │ │ └── hot_add_nic.yaml
│ │ └── snapshots.class
│ │ │ ├── __class__.yaml
│ │ │ ├── __methods__
│ │ │ ├── create_snapshot.rb
│ │ │ ├── create_snapshot.yaml
│ │ │ ├── delete_snapshot.rb
│ │ │ ├── delete_snapshot.yaml
│ │ │ ├── dialog_list_snapshots.rb
│ │ │ ├── dialog_list_snapshots.yaml
│ │ │ ├── revert_snapshot.rb
│ │ │ └── revert_snapshot.yaml
│ │ │ ├── create_snapshot.yaml
│ │ │ ├── delete_snapshot.yaml
│ │ │ ├── dialog_list_snapshots.yaml
│ │ │ └── revert_snapshot.yaml
│ └── __namespace__.yaml
├── System
│ ├── Request.class
│ │ ├── __class__.yaml
│ │ ├── create_snapshot.yaml
│ │ ├── delete_snapshot.yaml
│ │ ├── hot_add_disk.yaml
│ │ ├── hot_add_nic.yaml
│ │ └── revert_snapshot.yaml
│ └── __namespace__.yaml
└── __domain__.yaml
├── LICENSE
├── OpenStack
├── HEAT
│ ├── README.md
│ └── WordPress_Native.yaml
├── create_lbaas.rb
├── create_service_snapshot.rb
└── create_snapshot.rb
├── README.md
├── check_puppet
├── README.md
└── checkpuppet.rb
├── control-policies
├── README.md
├── VM-Security-Profile-with-Ansible-Action.yaml
└── VM-Security-Profile.yaml
├── delete_from_foreman
├── README.md
├── deletefromforeman.rb
└── remove_from_katello.rb
├── install_all_updates
├── README.md
├── dialog_export_20150911_114244.yml
└── install_all_updates.rb
├── register_foreman
├── CatalogItemInitialization.rb
├── CustomizeRequest.rb
├── README.md
├── register_foreman-class.png
├── register_foreman.rb
└── vmprovision_vm-class.png
├── rhev
├── README.md
├── cjung
│ ├── Integration
│ │ ├── RHEV
│ │ │ ├── __namespace__.yaml
│ │ │ └── snapshots.class
│ │ │ │ ├── __class__.yaml
│ │ │ │ ├── __methods__
│ │ │ │ ├── create_snapshot.rb
│ │ │ │ ├── create_snapshot.yaml
│ │ │ │ ├── delete_snapshot.rb
│ │ │ │ ├── delete_snapshot.yaml
│ │ │ │ ├── dialog_list_snapshots.rb
│ │ │ │ ├── dialog_list_snapshots.yaml
│ │ │ │ ├── revert_snapshot.rb
│ │ │ │ └── revert_snapshot.yaml
│ │ │ │ ├── create_snapshot.yaml
│ │ │ │ ├── delete_snapshot.yaml
│ │ │ │ ├── dialog_list_snapshots.yaml
│ │ │ │ └── revert_snapshot.yaml
│ │ └── __namespace__.yaml
│ ├── System
│ │ ├── Request.class
│ │ │ ├── __class__.yaml
│ │ │ ├── create_snapshot.yaml
│ │ │ ├── delete_snapshot.yaml
│ │ │ └── revert_snapshot.yaml
│ │ └── __namespace__.yaml
│ └── __domain__.yaml
└── dialog_export_20150617_082602.yml
├── service-dialogs
├── dialog-hot-add-disk.yml
└── dialog-hot-add-nic.yml
├── templates
└── new-method.rb
└── vmware_execute_command
└── runProgramInGuest.rb
/.gitignore:
--------------------------------------------------------------------------------
1 | *.gem
2 | *.rbc
3 | /.config
4 | /coverage/
5 | /InstalledFiles
6 | /pkg/
7 | /spec/reports/
8 | /test/tmp/
9 | /test/version_tmp/
10 | /tmp/
11 |
12 | ## Specific to RubyMotion:
13 | .dat*
14 | .repl_history
15 | build/
16 |
17 | ## Documentation cache and generated files:
18 | /.yardoc/
19 | /_yardoc/
20 | /doc/
21 | /rdoc/
22 |
23 | ## Environment normalisation:
24 | /.bundle/
25 | /vendor/bundle
26 | /lib/bundler/man/
27 |
28 | # for a library or gem, you might want to ignore these files since the code is
29 | # intended to run in multiple environments; otherwise, check them in:
30 | # Gemfile.lock
31 | # .ruby-version
32 | # .ruby-gemset
33 |
34 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35 | .rvmrc
36 |
--------------------------------------------------------------------------------
/Automate/Infrastructure/VM/Provisioning/StateMachines/Methods.class/__class__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: class
3 | version: 1.0
4 | object:
5 | attributes:
6 | description:
7 | display_name:
8 | name: Methods
9 | type:
10 | inherits:
11 | visibility:
12 | owner:
13 | schema:
14 | - field:
15 | aetype: relationship
16 | name: common_rel1
17 | display_name: ''
18 | datatype: string
19 | priority: 1
20 | owner:
21 | default_value:
22 | substitute: true
23 | message: "*"
24 | visibility:
25 | collect:
26 | scope:
27 | description:
28 | condition:
29 | on_entry:
30 | on_exit:
31 | on_error:
32 | max_retries:
33 | max_time:
34 | - field:
35 | aetype: method
36 | name: common_meth1
37 | display_name: ''
38 | datatype: string
39 | priority: 2
40 | owner:
41 | default_value:
42 | substitute: true
43 | message: "*"
44 | visibility:
45 | collect:
46 | scope:
47 | description:
48 | condition:
49 | on_entry:
50 | on_exit:
51 | on_error:
52 | max_retries:
53 | max_time:
54 | - field:
55 | aetype: relationship
56 | name: rel1
57 | display_name: ''
58 | datatype: string
59 | priority: 3
60 | owner:
61 | default_value:
62 | substitute: true
63 | message: create
64 | visibility:
65 | collect:
66 | scope:
67 | description:
68 | condition:
69 | on_entry:
70 | on_exit:
71 | on_error:
72 | max_retries:
73 | max_time:
74 | - field:
75 | aetype: method
76 | name: execute
77 | display_name: ''
78 | datatype: string
79 | priority: 4
80 | owner:
81 | default_value:
82 | substitute: true
83 | message: create
84 | visibility:
85 | collect:
86 | scope:
87 | description:
88 | condition:
89 | on_entry:
90 | on_exit:
91 | on_error:
92 | max_retries:
93 | max_time:
94 | - field:
95 | aetype: relationship
96 | name: vmware_rel1
97 | display_name: ''
98 | datatype: string
99 | priority: 5
100 | owner:
101 | default_value:
102 | substitute: true
103 | message: vmware
104 | visibility:
105 | collect:
106 | scope:
107 | description:
108 | condition:
109 | on_entry:
110 | on_exit:
111 | on_error:
112 | max_retries:
113 | max_time:
114 | - field:
115 | aetype: method
116 | name: vmware_meth1
117 | display_name: ''
118 | datatype: string
119 | priority: 6
120 | owner:
121 | default_value:
122 | substitute: true
123 | message: vmware
124 | visibility:
125 | collect:
126 | scope:
127 | description:
128 | condition:
129 | on_entry:
130 | on_exit:
131 | on_error:
132 | max_retries:
133 | max_time:
134 | - field:
135 | aetype: relationship
136 | name: redhat_rel1
137 | display_name: ''
138 | datatype: string
139 | priority: 7
140 | owner:
141 | default_value:
142 | substitute: true
143 | message: redhat
144 | visibility:
145 | collect:
146 | scope:
147 | description:
148 | condition:
149 | on_entry:
150 | on_exit:
151 | on_error:
152 | max_retries:
153 | max_time:
154 | - field:
155 | aetype: method
156 | name: redhat_meth1
157 | display_name: ''
158 | datatype: string
159 | priority: 8
160 | owner:
161 | default_value:
162 | substitute: true
163 | message: redhat
164 | visibility:
165 | collect:
166 | scope:
167 | description:
168 | condition:
169 | on_entry:
170 | on_exit:
171 | on_error:
172 | max_retries:
173 | max_time:
174 | - field:
175 | aetype: relationship
176 | name: microsoft_rel1
177 | display_name:
178 | datatype: string
179 | priority: 9
180 | owner:
181 | default_value:
182 | substitute: true
183 | message: microsoft
184 | visibility:
185 | collect:
186 | scope:
187 | description:
188 | condition:
189 | on_entry:
190 | on_exit:
191 | on_error:
192 | max_retries:
193 | max_time:
194 | - field:
195 | aetype: method
196 | name: microsoft_meth1
197 | display_name:
198 | datatype: string
199 | priority: 10
200 | owner:
201 | default_value:
202 | substitute: true
203 | message: microsoft
204 | visibility:
205 | collect:
206 | scope:
207 | description:
208 | condition:
209 | on_entry:
210 | on_exit:
211 | on_error:
212 | max_retries:
213 | max_time:
214 |
--------------------------------------------------------------------------------
/Automate/Infrastructure/VM/Provisioning/StateMachines/Methods.class/__methods__/redhat_customizerequest.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Description: This method is used to Customize the RHEV, RHEV PXE, and RHEV ISO Provisioning Request
3 | #
4 |
5 | # hello Victor
6 |
7 | # Get provisioning object
8 | prov = $evm.root["miq_provision"]
9 |
10 | $evm.log("info", "Disabling VM Autostart")
11 | prov.set_option(:vm_auto_start,[false,0])
12 |
13 | dialog_vmname = prov.get_option(:dialog_vmname)
14 | if not dialog_vmname.nil?
15 | $evm.log("info", "Setting VM name to: #{dialog_vmname}")
16 | prov.set_option(:vm_target_name,dialog_vmname)
17 | end
18 |
19 | dialog_fqdn = prov.get_option(:dialog_fqdn)
20 | if not dialog_fqdn.nil?
21 | $evm.log("info", "Setting FQDN to: #{dialog_fqdn}")
22 | prov.set_option(:vm_target_hostname,dialog_fqdn)
23 | end
24 |
25 | $evm.log("info", "Provisioning ID:<#{prov.id}> Provision Request ID:<#{prov.miq_provision_request.id}> Provision Type: <#{prov.provision_type}>")
26 |
--------------------------------------------------------------------------------
/Automate/Infrastructure/VM/Provisioning/StateMachines/Methods.class/__methods__/redhat_customizerequest.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: redhat_CustomizeRequest
7 | display_name:
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM.class/__class__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: class
3 | version: 1.0
4 | object:
5 | attributes:
6 | description: Factory State Machines
7 | display_name:
8 | name: VMProvision_VM
9 | type:
10 | inherits:
11 | visibility:
12 | owner:
13 | schema:
14 | - field:
15 | aetype: state
16 | name: CustomizeRequest
17 | display_name:
18 | datatype: string
19 | priority: 1
20 | owner:
21 | default_value: "/Infrastructure/VM/Provisioning/StateMachines/Methods/CustomizeRequest#${/#miq_provision.source.vendor}"
22 | substitute: true
23 | message: create
24 | visibility:
25 | collect:
26 | scope:
27 | description:
28 | condition:
29 | on_entry: update_provision_status(status => 'Customizing Request')
30 | on_exit: update_provision_status(status => 'Customized Request')
31 | on_error: update_provision_status(status => 'Error Customizing Request')
32 | max_retries: '100'
33 | max_time:
34 | - field:
35 | aetype: state
36 | name: AcquireIPAddress
37 | display_name:
38 | datatype: string
39 | priority: 2
40 | owner:
41 | default_value:
42 | substitute: true
43 | message: create
44 | visibility:
45 | collect:
46 | scope:
47 | description:
48 | condition:
49 | on_entry: update_provision_status(status => 'Acquiring IP Address')
50 | on_exit: update_provision_status(status => 'Acquired IP Address')
51 | on_error: update_provision_status(status => 'Error Acquiring IP Address')
52 | max_retries: '100'
53 | max_time:
54 | - field:
55 | aetype: state
56 | name: AcquireMACAddress
57 | display_name:
58 | datatype: string
59 | priority: 3
60 | owner:
61 | default_value:
62 | substitute: true
63 | message: create
64 | visibility:
65 | collect:
66 | scope:
67 | description:
68 | condition:
69 | on_entry: update_provision_status(status => 'Acquiring MAC Address')
70 | on_exit: update_provision_status(status => 'Acquired MAC Address')
71 | on_error: update_provision_status(status => 'Error Acquiring MAC Address')
72 | max_retries: '100'
73 | max_time:
74 | - field:
75 | aetype: state
76 | name: RegisterDNS
77 | display_name:
78 | datatype: string
79 | priority: 4
80 | owner:
81 | default_value:
82 | substitute: true
83 | message: create
84 | visibility:
85 | collect:
86 | scope:
87 | description:
88 | condition:
89 | on_entry: update_provision_status(status => 'Registering DNS')
90 | on_exit: update_provision_status(status => 'Registered DNS')
91 | on_error: update_provision_status(status => 'Error Registering DNS')
92 | max_retries: '100'
93 | max_time:
94 | - field:
95 | aetype: state
96 | name: RegisterCMDB
97 | display_name:
98 | datatype: string
99 | priority: 5
100 | owner:
101 | default_value:
102 | substitute: true
103 | message: create
104 | visibility:
105 | collect:
106 | scope:
107 | description:
108 | condition:
109 | on_entry: update_provision_status(status => 'Registering CMDB')
110 | on_exit: update_provision_status(status => 'Registered CMDB')
111 | on_error: update_provision_status(status => 'Error Registering CMDB')
112 | max_retries: '100'
113 | max_time:
114 | - field:
115 | aetype: state
116 | name: RegisterAD
117 | display_name:
118 | datatype: string
119 | priority: 6
120 | owner:
121 | default_value:
122 | substitute: true
123 | message: create
124 | visibility:
125 | collect:
126 | scope:
127 | description:
128 | condition:
129 | on_entry: update_provision_status(status => 'Registering ActiveDirectory')
130 | on_exit: update_provision_status(status => 'Registered ActiveDirectory')
131 | on_error: update_provision_status(status => 'Error Registering ActiveDirectory')
132 | max_retries: '100'
133 | max_time:
134 | - field:
135 | aetype: state
136 | name: Placement
137 | display_name:
138 | datatype: string
139 | priority: 7
140 | owner:
141 | default_value: "/Infrastructure/VM/Provisioning/Placement/default#${/#miq_provision.source.vendor}"
142 | substitute: true
143 | message: create
144 | visibility:
145 | collect:
146 | scope:
147 | description:
148 | condition:
149 | on_entry: update_provision_status(status => 'Starting Placement')
150 | on_exit: update_provision_status(status => 'Finished Placement')
151 | on_error: update_provision_status(status => 'Error in Placement')
152 | max_retries:
153 | max_time:
154 | - field:
155 | aetype: state
156 | name: PreProvision
157 | display_name:
158 | datatype: string
159 | priority: 8
160 | owner:
161 | default_value: "/Infrastructure/VM/Provisioning/StateMachines/Methods/PreProvision#${/#miq_provision.source.vendor}"
162 | substitute: true
163 | message: create
164 | visibility:
165 | collect:
166 | scope:
167 | description:
168 | condition:
169 | on_entry: update_provision_status(status => 'Applying PreProvision Customizations')
170 | on_exit: update_provision_status(status => 'Applied PreProvision Customizations')
171 | on_error: update_provision_status(status => 'Error Applying PreProvision Customizations')
172 | max_retries: '100'
173 | max_time:
174 | - field:
175 | aetype: state
176 | name: Provision
177 | display_name:
178 | datatype: string
179 | priority: 9
180 | owner:
181 | default_value: "/Infrastructure/VM/Provisioning/StateMachines/Methods/Provision"
182 | substitute: true
183 | message: create
184 | visibility:
185 | collect:
186 | scope:
187 | description:
188 | condition:
189 | on_entry: update_provision_status(status => 'Creating VM')
190 | on_exit: update_provision_status(status => 'Creating VM')
191 | on_error: update_provision_status(status => 'Error Creating VM')
192 | max_retries: '100'
193 | max_time:
194 | - field:
195 | aetype: state
196 | name: CheckProvisioned
197 | display_name:
198 | datatype: string
199 | priority: 10
200 | owner:
201 | default_value: "/Infrastructure/VM/Provisioning/StateMachines/Methods/CheckProvisioned"
202 | substitute: true
203 | message: create
204 | visibility:
205 | collect:
206 | scope:
207 | description:
208 | condition:
209 | on_entry:
210 | on_exit: update_provision_status(status => 'Creating VM')
211 | on_error: update_provision_status(status => '${/#ae_reason}')
212 | max_retries: '100'
213 | max_time:
214 | - field:
215 | aetype: state
216 | name: CreateCobblerRecord
217 | display_name:
218 | datatype: string
219 | priority: 11
220 | owner:
221 | default_value: "/Integration/ConfigurationManagement/Cobbler/create_cobbler_record"
222 | substitute: true
223 | message: create
224 | visibility:
225 | collect:
226 | scope:
227 | description:
228 | condition:
229 | on_entry:
230 | on_exit:
231 | on_error:
232 | max_retries:
233 | max_time:
234 | - field:
235 | aetype: state
236 | name: RegisterForeman
237 | display_name:
238 | datatype: string
239 | priority: 12
240 | owner:
241 | default_value: "/Integration/ConfigurationManagement/Foreman/register_foreman"
242 | substitute: true
243 | message: create
244 | visibility:
245 | collect:
246 | scope:
247 | description:
248 | condition:
249 | on_entry:
250 | on_exit:
251 | on_error:
252 | max_retries:
253 | max_time:
254 | - field:
255 | aetype: state
256 | name: PostProvision
257 | display_name:
258 | datatype: string
259 | priority: 13
260 | owner:
261 | default_value: "/Infrastructure/VM/Provisioning/StateMachines/Methods/PostProvision#${/#miq_provision.source.vendor}"
262 | substitute: true
263 | message: create
264 | visibility:
265 | collect:
266 | scope:
267 | description:
268 | condition:
269 | on_entry: update_provision_status(status => 'Applying PostProvision Customizations')
270 | on_exit: update_provision_status(status => 'Applied PostProvision Customizations')
271 | on_error: update_provision_status(status => 'Error Applying PostProvision Customizations')
272 | max_retries:
273 | max_time:
274 | - field:
275 | aetype: state
276 | name: RegisterDHCP
277 | display_name:
278 | datatype: string
279 | priority: 14
280 | owner:
281 | default_value:
282 | substitute: true
283 | message: create
284 | visibility:
285 | collect:
286 | scope:
287 | description:
288 | condition:
289 | on_entry: update_provision_status(status => 'Registering DHCP')
290 | on_exit: update_provision_status(status => 'Registered DHCP')
291 | on_error: update_provision_status(status => 'Error Registering DHCP')
292 | max_retries: '100'
293 | max_time:
294 | - field:
295 | aetype: state
296 | name: ActivateCMDB
297 | display_name:
298 | datatype: string
299 | priority: 15
300 | owner:
301 | default_value:
302 | substitute: true
303 | message: create
304 | visibility:
305 | collect:
306 | scope:
307 | description:
308 | condition:
309 | on_entry: update_provision_status(status => 'Activating CMDB')
310 | on_exit: update_provision_status(status => 'Activated CMDB')
311 | on_error: update_provision_status(status => 'Error Activating CMDB')
312 | max_retries: '100'
313 | max_time:
314 | - field:
315 | aetype: state
316 | name: EmailOwner
317 | display_name:
318 | datatype: string
319 | priority: 16
320 | owner:
321 | default_value: "/Infrastructure/VM/Provisioning/Email/MiqProvision_Complete?event=vm_provisioned"
322 | substitute: true
323 | message: create
324 | visibility:
325 | collect:
326 | scope:
327 | description:
328 | condition:
329 | on_entry: update_provision_status(status => 'Emailing Owner')
330 | on_exit: update_provision_status(status => 'Emailed Owner')
331 | on_error: update_provision_status(status => 'Error Emailing Owner')
332 | max_retries: '100'
333 | max_time:
334 | - field:
335 | aetype: state
336 | name: Finished
337 | display_name:
338 | datatype: string
339 | priority: 17
340 | owner:
341 | default_value: "/System/CommonMethods/StateMachineMethods/vm_provision_finished"
342 | substitute: true
343 | message: create
344 | visibility:
345 | collect:
346 | scope:
347 | description:
348 | condition:
349 | on_entry:
350 | on_exit:
351 | on_error:
352 | max_retries: '100'
353 | max_time:
354 |
--------------------------------------------------------------------------------
/Automate/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM.class/template.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: Provision VM from Template
7 | name: template
8 | inherits:
9 | description:
10 | fields:
11 | - Provision:
12 | value: "/Infrastructure/VM/Provisioning/StateMachines/Methods/Provision"
13 | - CheckProvisioned:
14 | value: "/Infrastructure/VM/Provisioning/StateMachines/Methods/CheckProvisioned"
15 |
--------------------------------------------------------------------------------
/Automate/Infrastructure/VM/Provisioning/StateMachines/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: StateMachines
7 | description:
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/Automate/Infrastructure/VM/Provisioning/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: Provisioning
7 | description:
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/Automate/Infrastructure/VM/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: VM
7 | description:
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/Automate/Infrastructure/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: Infrastructure
7 | description:
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/Automate/Integration/ConfigurationManagement/Cobbler.class/__class__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: class
3 | version: 1.0
4 | object:
5 | attributes:
6 | description: Cobbler
7 | display_name: Cobbler
8 | name: Cobbler
9 | type:
10 | inherits:
11 | visibility:
12 | owner:
13 | schema:
14 | - field:
15 | aetype: attribute
16 | name: cobbler_host
17 | display_name:
18 | datatype: string
19 | priority: 1
20 | owner:
21 | default_value:
22 | substitute: true
23 | message: create
24 | visibility:
25 | collect:
26 | scope:
27 | description:
28 | condition:
29 | on_entry:
30 | on_exit:
31 | on_error:
32 | max_retries:
33 | max_time:
34 | - field:
35 | aetype: attribute
36 | name: cobbler_user
37 | display_name:
38 | datatype: string
39 | priority: 2
40 | owner:
41 | default_value:
42 | substitute: true
43 | message: create
44 | visibility:
45 | collect:
46 | scope:
47 | description:
48 | condition:
49 | on_entry:
50 | on_exit:
51 | on_error:
52 | max_retries:
53 | max_time:
54 | - field:
55 | aetype: attribute
56 | name: cobbler_password
57 | display_name:
58 | datatype: password
59 | priority: 3
60 | owner:
61 | default_value:
62 | substitute: true
63 | message: create
64 | visibility:
65 | collect:
66 | scope:
67 | description:
68 | condition:
69 | on_entry:
70 | on_exit:
71 | on_error:
72 | max_retries:
73 | max_time:
74 | - field:
75 | aetype: attribute
76 | name: cobbler_profile
77 | display_name:
78 | datatype: string
79 | priority: 4
80 | owner:
81 | default_value:
82 | substitute: true
83 | message: create
84 | visibility:
85 | collect:
86 | scope:
87 | description:
88 | condition:
89 | on_entry:
90 | on_exit:
91 | on_error:
92 | max_retries:
93 | max_time:
94 | - field:
95 | aetype: method
96 | name: execute
97 | display_name:
98 | datatype: string
99 | priority: 5
100 | owner:
101 | default_value: create_cobbler_record
102 | substitute: true
103 | message: create
104 | visibility:
105 | collect:
106 | scope:
107 | description:
108 | condition:
109 | on_entry:
110 | on_exit:
111 | on_error:
112 | max_retries:
113 | max_time:
114 |
--------------------------------------------------------------------------------
/Automate/Integration/ConfigurationManagement/Cobbler.class/__methods__/create_cobbler_record.rb:
--------------------------------------------------------------------------------
1 | ###################################
2 | #
3 | # This method creates a cobbler record for the given VM
4 | #
5 | # Copyright (C) 2016, Christian Jung
6 | # This program is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # This program is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with this program. If not, see .
18 | #
19 | ###################################
20 | require 'xmlrpc/client'
21 |
22 | @method = 'create_cobbler_record'
23 | $evm.log("info", "#{@method} - Starting")
24 |
25 | # get provision object
26 | prov = $evm.root['miq_provision'] || $evm.root['miq_provision_request'] || $evm.root['miq_provision_request_template']
27 |
28 | # print all root objects
29 | $evm.root.attributes.sort.each { |k, v| $evm.log("info", "@{method} Root:<$evm.root> Attribute - #{k}: #{v}")}
30 |
31 | cobbler_host = $evm.object["cobbler_host"]
32 | $evm.log("info", "#{@method} - Cobbler Server: #{cobbler_host}")
33 | cobbler_user = $evm.object["cobbler_user"]
34 | $evm.log("info", "#{@method} - Cobbler User: #{cobbler_user}")
35 | cobbler_password = $evm.object.decrypt("cobbler_password")
36 | $evm.log("info", "#{@method} - Cobbler Password: < intentionally not written to the log >")
37 | cobbler_profile = $evm.object["cobbler_profile"]
38 | $evm.log("info", "#{@method} - Cobbler Kickstart: #{cobbler_profile}")
39 |
40 | vm = prov.vm
41 |
42 | # we have to check the MAC address of the new VM, if it doesn't have one, we have to wait
43 | if vm.mac_addresses != nil and vm.mac_addresses!=[]
44 | $evm.log("info", "#{@method} - MacAddresses found: #{vm.mac_addresses.inspect}")
45 |
46 | # create Cobbler record
47 | interfaces = {}
48 | interfaces["static-eth0"]=false
49 | interfaces["macaddress-eth0"]=vm.mac_addresses[0]
50 | $evm.log("info", "#{@method} - Connecting to Cobbler:")
51 | begin
52 | $evm.log("info", "#{@method} Creating #{vm.name} in Cobbler")
53 | connection = XMLRPC::Client.new(cobbler_host, '/cobbler_api')
54 | token = connection.call('login', cobbler_user, cobbler_password)
55 | system_id = connection.call('new_system', token)
56 | $evm.log("info", "#{@method} - Setting name to #{vm.name}")
57 | connection.call('modify_system', system_id, 'name', vm.name, token)
58 | $evm.log("info", "#{@method} - Setting hostname to #{vm.name}")
59 | hostname=prov.get_option(:vm_target_hostname)
60 | connection.call('modify_system', system_id, 'hostname', hostname, token)
61 | $evm.log("info", "#{@method} - Setting network interfaces to #{interfaces}")
62 | connection.call('modify_system', system_id, 'modify_interface', interfaces, token)
63 | $evm.log("info", "#{@method} - Setting kickstart profile to #{cobbler_profile}")
64 | connection.call('modify_system', system_id, 'profile', cobbler_profile, token)
65 | $evm.log("info", "#{@method} - Saving system")
66 | connection.call('save_system', system_id, token)
67 | rescue XMLRPC::FaultException => err
68 | $evm.log("error", "#{@method} - [#{err}]\n#{err.faultString}")
69 | exit MIQ_ABORT
70 | end
71 | $evm.log("info", "#{@method} - Cobbler record created, starting VM")
72 | vm.start
73 | else
74 | $evm.log("info", "#{@method} - No Mac Address found - Waiting 20 sconds")
75 | $evm.root['ae_result'] = 'retry'
76 | $evm.root['ae_retry_interval'] = '20.seconds'
77 | exit MIQ_OK
78 | end
79 |
80 | #
81 | # Exit method
82 | #
83 | $evm.log("info", "#{@method} -EVM Automate Method Ended")
84 | exit MIQ_OK
85 |
--------------------------------------------------------------------------------
/Automate/Integration/ConfigurationManagement/Cobbler.class/__methods__/create_cobbler_record.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: create_cobbler_record
7 | display_name: " create_cobbler_record "
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Integration/ConfigurationManagement/Cobbler.class/create_cobbler_record.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: create_cobbler_record
7 | name: create_cobbler_record
8 | inherits:
9 | description: create_cobbler_record
10 | fields:
11 | - execute:
12 | value: " create_cobbler_record "
13 |
--------------------------------------------------------------------------------
/Automate/Integration/ConfigurationManagement/Foreman.class/__class__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: class
3 | version: 1.0
4 | object:
5 | attributes:
6 | description: Foreman
7 | display_name: Foreman
8 | name: Foreman
9 | type:
10 | inherits:
11 | visibility:
12 | owner:
13 | schema:
14 | - field:
15 | aetype: attribute
16 | name: hostgroup_name
17 | display_name:
18 | datatype: string
19 | priority: 1
20 | owner:
21 | default_value:
22 | substitute: true
23 | message: create
24 | visibility:
25 | collect:
26 | scope:
27 | description:
28 | condition:
29 | on_entry:
30 | on_exit:
31 | on_error:
32 | max_retries:
33 | max_time:
34 | - field:
35 | aetype: attribute
36 | name: organization_name
37 | display_name:
38 | datatype: string
39 | priority: 2
40 | owner:
41 | default_value:
42 | substitute: true
43 | message: create
44 | visibility:
45 | collect:
46 | scope:
47 | description:
48 | condition:
49 | on_entry:
50 | on_exit:
51 | on_error:
52 | max_retries:
53 | max_time:
54 | - field:
55 | aetype: attribute
56 | name: location_name
57 | display_name:
58 | datatype: string
59 | priority: 3
60 | owner:
61 | default_value:
62 | substitute: true
63 | message: create
64 | visibility:
65 | collect:
66 | scope:
67 | description:
68 | condition:
69 | on_entry:
70 | on_exit:
71 | on_error:
72 | max_retries:
73 | max_time:
74 | - field:
75 | aetype: attribute
76 | name: foreman_host
77 | display_name:
78 | datatype: string
79 | priority: 4
80 | owner:
81 | default_value:
82 | substitute: true
83 | message: create
84 | visibility:
85 | collect:
86 | scope:
87 | description:
88 | condition:
89 | on_entry:
90 | on_exit:
91 | on_error:
92 | max_retries:
93 | max_time:
94 | - field:
95 | aetype: attribute
96 | name: foreman_user
97 | display_name:
98 | datatype: string
99 | priority: 5
100 | owner:
101 | default_value:
102 | substitute: true
103 | message: create
104 | visibility:
105 | collect:
106 | scope:
107 | description:
108 | condition:
109 | on_entry:
110 | on_exit:
111 | on_error:
112 | max_retries:
113 | max_time:
114 | - field:
115 | aetype: attribute
116 | name: foreman_password
117 | display_name:
118 | datatype: password
119 | priority: 6
120 | owner:
121 | default_value:
122 | substitute: true
123 | message: create
124 | visibility:
125 | collect:
126 | scope:
127 | description:
128 | condition:
129 | on_entry:
130 | on_exit:
131 | on_error:
132 | max_retries:
133 | max_time:
134 | - field:
135 | aetype: method
136 | name: execute
137 | display_name:
138 | datatype: string
139 | priority: 7
140 | owner:
141 | default_value:
142 | substitute: true
143 | message: create
144 | visibility:
145 | collect:
146 | scope:
147 | description:
148 | condition:
149 | on_entry:
150 | on_exit:
151 | on_error:
152 | max_retries:
153 | max_time:
154 |
--------------------------------------------------------------------------------
/Automate/Integration/ConfigurationManagement/Foreman.class/__methods__/register_foreman.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Description: Create configured host record in Foreman
3 | #
4 |
5 | @method = 'register_foreman'
6 |
7 | $evm.log("info", "#{@method} - EVM Automate Method Started")
8 |
9 | # Dump all of root's attributes to the log
10 | $evm.root.attributes.sort.each { |k, v| $evm.log("info", "#{@method} Root:<$evm.root> Attribute - #{k}: #{v}")}
11 |
12 | require 'rest-client'
13 | require 'json'
14 | require 'openssl'
15 | require 'base64'
16 |
17 | foreman_host = $evm.object['foreman_host']
18 | foreman_user = $evm.object['foreman_user']
19 | foreman_password = $evm.object.decrypt('foreman_password')
20 | hostgroup_name = $evm.object['hostgroup_name']
21 | organization_name = $evm.object['organization_name']
22 | location_name = $evm.object['location_name']
23 |
24 | prov = $evm.root['miq_provision']
25 | vm = prov.vm
26 |
27 | @uri_base = "https://#{foreman_host}/api/v2"
28 | @headers = {
29 | :content_type => 'application/json',
30 | :accept => 'application/json;version=2',
31 | :authorization => "Basic #{Base64.strict_encode64("#{foreman_user}:#{foreman_password}")}"
32 | }
33 |
34 | def query_id (queryuri,queryfield,querycontent)
35 | # queryuri: path name related to @uri_base, where to search (hostgroups, locations, ...)
36 | # queryfield: which field (as in database row) should be searched
37 | # querycontent: what the queryfield has to match (exact match)
38 |
39 | # Put the search URL together
40 | url = URI.escape("#{@uri_base}/#{queryuri}?search=#{queryfield}=\"#{querycontent}\"")
41 |
42 | $evm.log("info", "url => #{url}")
43 |
44 | request = RestClient::Request.new(
45 | method: :get,
46 | url: url,
47 | headers: @headers,
48 | verify_ssl: OpenSSL::SSL::VERIFY_NONE
49 | )
50 |
51 | rest_result = request.execute
52 | json_parse = JSON.parse(rest_result)
53 |
54 | # The subtotal value is the number of matching results.
55 | # If it is higher than one, the query got no unique result!
56 | subtotal = json_parse['subtotal'].to_i
57 |
58 | if subtotal == 0
59 | $evm.log("info", "query failed, no result #{url}")
60 | return -1
61 | elsif subtotal == 1
62 | id = json_parse['results'][0]['id'].to_s
63 | return id
64 | elsif subtotal > 1
65 | $evm.log("info", "query failed, more than one result #{url}")
66 | return -1
67 | end
68 |
69 | $evm.log("info", "query failed, unknown condition #{url}")
70 | return -1
71 | end
72 |
73 | # Get the hostgroup id using the supplied name
74 | $evm.log("info", 'Getting hostgroup id from Foreman')
75 | hostgroup_id=query_id("hostgroups","name",hostgroup_name)
76 | $evm.log("info", "hostgroup_id: #{hostgroup_id}")
77 | if hostgroup_id == -1
78 | $evm.log("info", "Cannot continue without hostgroup_id")
79 | exit MIQ_ABORT
80 | end
81 |
82 | # Get the location id using the supplied name
83 | $evm.log("info", 'Getting location id from Foreman')
84 | location_id=query_id("locations","name",location_name)
85 | $evm.log("info", "location_id: #{location_id}")
86 | if location_id == -1
87 | $evm.log("info", "Cannot continue without location_id")
88 | exit MIQ_ABORT
89 | end
90 |
91 | # Get the organization id using the supplied name
92 | $evm.log("info", 'Getting organization id from Foreman')
93 | organization_id=query_id("organizations","name",organization_name)
94 | $evm.log("info", "organization_id: #{organization_id}")
95 | if organization_id == -1
96 | $evm.log("info", "Cannot continue without organization_id")
97 | exit MIQ_ABORT
98 | end
99 |
100 | # Create the host via Foreman
101 | uri = "#{@uri_base}"
102 | # Now create the host in Foreman
103 | $evm.log("info", 'Creating host in Foreman')
104 |
105 | hostinfo = {
106 | :name => vm.name,
107 | :mac => vm.mac_addresses[0],
108 | :hostgroup_id => hostgroup_id,
109 | :location_id => location_id,
110 | :organization_id => organization_id,
111 | :build => 'true'
112 | }
113 | $evm.log("info", "Sending Host Details: #{hostinfo}")
114 |
115 | uri = "#{@uri_base}/hosts"
116 | request = RestClient::Request.new(
117 | method: :post,
118 | url: uri,
119 | headers: @headers,
120 | verify_ssl: OpenSSL::SSL::VERIFY_NONE,
121 | payload: { host: hostinfo }.to_json
122 | )
123 |
124 | rest_result = request.execute
125 | $evm.log("info", "return code => <#{rest_result.code}>")
126 |
127 | json_parse = JSON.parse(rest_result)
128 | hostid = json_parse['id'].to_s
129 |
130 | $evm.log("info", "Storing Foreman host ID of new VM: #{hostid}")
131 | prov.set_option(:hostid,hostid)
132 |
133 | $evm.log("info", "Powering on VM")
134 | vm.start
135 |
136 | exit MIQ_OK
137 |
--------------------------------------------------------------------------------
/Automate/Integration/ConfigurationManagement/Foreman.class/__methods__/register_foreman.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: register_foreman
7 | display_name: register_foreman
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Integration/ConfigurationManagement/Foreman.class/register_foreman.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: register_foreman
7 | name: register_foreman
8 | inherits:
9 | description: register_foreman
10 | fields:
11 | - execute:
12 | value: register_foreman
13 |
--------------------------------------------------------------------------------
/Automate/Integration/ConfigurationManagement/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: ConfigurationManagement
7 | description:
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: RHEV
7 | description:
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/__class__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: class
3 | version: 1.0
4 | object:
5 | attributes:
6 | description: reconfigure_vm
7 | display_name: reconfigure_vm
8 | name: reconfigure_vm
9 | type:
10 | inherits:
11 | visibility:
12 | owner:
13 | schema:
14 | - field:
15 | aetype: method
16 | name: execute
17 | display_name:
18 | datatype: string
19 | priority: 1
20 | owner:
21 | default_value:
22 | substitute: true
23 | message: create
24 | visibility:
25 | collect:
26 | scope:
27 | description:
28 | condition:
29 | on_entry:
30 | on_exit:
31 | on_error:
32 | max_retries:
33 | max_time:
34 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/__methods__/dialog_add_disk.rb:
--------------------------------------------------------------------------------
1 | ###################################
2 | #
3 | # This method returns the list of data stores to be used in a dynamic drop down list
4 | #
5 | # Copyright (C) 2016, Christian Jung
6 | # This program is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # This program is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with this program. If not, see .
18 | #
19 | ###################################
20 | def getstorages(rhevmhost,rhevmuser,rhevmpass)
21 | require 'rubygems'
22 | require 'rest_client'
23 | require 'nokogiri'
24 |
25 | storages = Array.new{Array.new}
26 |
27 | resource = RestClient::Resource.new(rhevmhost, :user => rhevmuser, :password => rhevmpass, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
28 | storage_data = Nokogiri::XML(resource["/api/storagedomains/"].get.body)
29 | storage_data.xpath("//storage_domain").each do |storage_domain|
30 | if storage_domain.xpath('type').text == "data"
31 | name=storage_domain.xpath('name').text
32 | $evm.log("info", "Name: #{name}")
33 | storages.push [name, name]
34 | end
35 | end
36 |
37 | return storages
38 | end
39 |
40 | begin
41 | @method = 'dialog_add_disk'
42 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Started")
43 |
44 | vm=$evm.root['vm']
45 | ext_mgt_system = vm.ext_management_system
46 |
47 | rhevmhost = "https://#{ext_mgt_system.hostname}"
48 | rhevmuser = ext_mgt_system.authentication_userid
49 | rhevmpass = ext_mgt_system.authentication_password
50 |
51 | vmuid=vm.uid_ems
52 | vmtype=vm.type
53 |
54 | $evm.log("info","#{@method} - ext_mgt_system: #{ext_mgt_system.hostname}")
55 | $evm.log("info","#{@method} - vm: #{vm}")
56 | $evm.log("info","#{@method} - vmuid: #{vmuid}")
57 | $evm.log("info","#{@method} - vmtype: #{vmtype}")
58 |
59 | unless vmtype == "ManageIQ::Providers::Redhat::InfraManager::Vm"
60 | # this will populate the dialog in case we are not on RHEV
61 | storages = Array.new{Array.new}
62 | storages.push ["No Valid","No Valid"]
63 | dialog_field = $evm.object
64 | dialog_field["sort_by"] = "value"
65 | dialog_field["data_type"] = "string"
66 | dialog_field["required"] = "true"
67 | dialog_field["values"] = storages
68 | dialog_field["default_value"] = "No Valid"
69 | $evm.log("info", "#{@method} - VM Type != RHEV")
70 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Ended")
71 | exit MIQ_OK
72 | end
73 |
74 | storages=getstorages(rhevmhost,rhevmuser,rhevmpass)
75 | $evm.log("info","#{@method} - storages: #{storages}")
76 |
77 | dialog_field = $evm.object
78 |
79 | # sort_by: value / description / none
80 | dialog_field["sort_by"] = "value"
81 |
82 | # sort_order: ascending / descending
83 | dialog_field["sort_order"] = "ascending"
84 |
85 | # data_type: string / integer
86 | dialog_field["data_type"] = "string"
87 |
88 | # required: true / false
89 | dialog_field["required"] = "true"
90 |
91 | dialog_field["values"] = storages
92 |
93 | dialog_field["default_value"] = storages.first.first
94 |
95 | #
96 | # Exit method
97 | #
98 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Ended")
99 | exit MIQ_OK
100 |
101 | #
102 | # Set Ruby rescue behavior
103 | #
104 | rescue => err
105 | $evm.log("error", "#{@method} - [#{err}]\n#{err.backtrace.join("\n")}")
106 | exit MIQ_ABORT
107 | end
108 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/__methods__/dialog_add_disk.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: dialog_add_disk
7 | display_name: dialog_add_disk
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/__methods__/dialog_add_nic.rb:
--------------------------------------------------------------------------------
1 | ###################################
2 | #
3 | # This method returns the list of network interfaces to be used in a dynamic drop down list
4 | #
5 | # Copyright (C) 2016, Christian Jung
6 | # This program is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # This program is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with this program. If not, see .
18 | #
19 | ###################################
20 |
21 | require 'rubygems'
22 | require 'rest_client'
23 | require 'nokogiri'
24 |
25 | @debug = false
26 |
27 | def getdatacentername(rhevmhost,rhevmuser,rhevmpass,href)
28 | resource = RestClient::Resource.new(rhevmhost, :user => rhevmuser, :password => rhevmpass, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
29 | datacenter_data=Nokogiri::XML(resource[href].get.body)
30 | name = datacenter_data.xpath("//name").text
31 | $evm.log("info", "#{@method} - Data Center Name: #{name}")
32 | return name
33 | end
34 |
35 | def getnetworks(rhevmhost,rhevmuser,rhevmpass)
36 | networks = Array.new{Array.new}
37 |
38 | network_uid=""
39 | datacenter_href=""
40 |
41 | resource = RestClient::Resource.new(rhevmhost, :user => rhevmuser, :password => rhevmpass, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
42 | network_data = Nokogiri::XML(resource["/api/networks/"].get.body)
43 | network_data.xpath("//network").each do |network|
44 | network_name = network.xpath("//name").text
45 | network_uid = network.to_h['id']
46 | hrefxml=network.xpath('data_center')
47 | datacenter_href = hrefxml.attr("href")
48 | datacenter_name = getdatacentername(rhevmhost,rhevmuser,rhevmpass,datacenter_href)
49 | desc="#{network_name} - #{datacenter_name}"
50 | networks.push [network_uid, desc]
51 | end
52 | return networks
53 | end
54 |
55 | begin
56 | @method = 'dialog_add_nic'
57 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Started")
58 |
59 | vm=$evm.root['vm']
60 | ext_mgt_system = vm.ext_management_system
61 |
62 | rhevmhost = "https://#{ext_mgt_system.hostname}"
63 | rhevmuser = ext_mgt_system.authentication_userid
64 | rhevmpass = ext_mgt_system.authentication_password
65 |
66 | vmuid=vm.uid_ems
67 | vmtype=vm.type
68 |
69 | $evm.log("info","#{@method} - vm: #{vm}")
70 | $evm.log("info","#{@method} - vmuid: #{vmuid}")
71 | $evm.log("info","#{@method} - vmtype: #{vmtype}")
72 |
73 | unless vmtype == "ManageIQ::Providers::Redhat::InfraManager::Vm"
74 | # this will populate the dialog in case we are not on RHEV
75 | networks = Array.new{Array.new}
76 | networks.push ["No Valid","No Valid"]
77 | dialog_field = $evm.object
78 | dialog_field["sort_by"] = "value"
79 | dialog_field["data_type"] = "string"
80 | dialog_field["required"] = "true"
81 | dialog_field["values"] = networks
82 | dialog_field["default_value"] = "No Valid"
83 | $evm.log("info", "#{@method} - VM Type != RHEV")
84 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Ended")
85 | exit MIQ_OK
86 | end
87 |
88 | networks=getnetworks(rhevmhost,rhevmuser,rhevmpass)
89 | $evm.log("info","#{@method} - networks: #{networks}")
90 |
91 | dialog_field = $evm.object
92 |
93 | # sort_by: value / description / none
94 | dialog_field["sort_by"] = "value"
95 |
96 | # sort_order: ascending / descending
97 | dialog_field["sort_order"] = "ascending"
98 |
99 | # data_type: string / integer
100 | dialog_field["data_type"] = "string"
101 |
102 | # required: true / false
103 | dialog_field["required"] = "true"
104 |
105 | dialog_field["values"] = networks
106 |
107 | dialog_field["default_value"] = networks.first.first
108 |
109 | #
110 | # Exit method
111 | #
112 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Ended")
113 | exit MIQ_OK
114 |
115 | #
116 | # Set Ruby rescue behavior
117 | #
118 | rescue => err
119 | $evm.log("error", "#{@method} - [#{err}]\n#{err.backtrace.join("\n")}")
120 | exit MIQ_ABORT
121 | end
122 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/__methods__/dialog_add_nic.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: dialog_add_nic
7 | display_name: dialog_add_nic
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/__methods__/hot_add_disk.rb:
--------------------------------------------------------------------------------
1 | ###################################
2 | #
3 | # This method creates an additional disk and attaches it to the VM
4 | #
5 | # Copyright (C) 2016, Christian Jung
6 | # This program is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # This program is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with this program. If not, see .
18 | #
19 | ###################################
20 |
21 | def attachhd(rhevmhost,rhevmuser,rhevmpass,vmuid,storage,size,allocpolicy)
22 | require 'rubygems'
23 | require 'rest_client'
24 | require 'nokogiri'
25 |
26 | size = (size.to_i * 1024 * 1024 * 1024)
27 | $evm.log("info", "#{@method} - size = #{size}")
28 |
29 | storageid=""
30 |
31 | resource = RestClient::Resource.new(rhevmhost, :user => rhevmuser, :password => rhevmpass, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
32 | storage_data = Nokogiri::XML(resource["/api/storagedomains/?search=name=#{storage}"].get.body)
33 | $evm.log("info", "#{@method} - storage_data: #{storage_data}")
34 | storage_data.xpath("//storage_domain").each do |storage_domain|
35 | storageid=storage_domain.to_h['id']
36 | $evm.log("info", "ID: #{storageid}")
37 | end
38 |
39 | sparse=""
40 | if allocpolicy == "thick"
41 | sparse="false"
42 | elsif allocpolicy == "thin"
43 | sparse="true"
44 | else
45 | $evm.log("info", "#{@method} - Allocation Policy unknown, using thin provisioning")
46 | sparse="true"
47 | end
48 |
49 | htmlhd = "#{size}virtiorawfalse#{sparse}"
50 |
51 | $evm.log("info", "html = #{htmlhd}")
52 | data = Nokogiri::XML(resource["/api/vms/" + vmuid + "/disks"].post(htmlhd, :content_type => 'application/xml', :accept => 'application/xml'))
53 | $evm.log("info", "VMs = #{data}")
54 |
55 | diskid = ""
56 | data.xpath("//storage_domain").each do |storage_domain|
57 | diskid=storage_domain.to_h['id']
58 | $evm.log("info", "#{@method} - disk id: #{diskid}")
59 | end
60 |
61 | # # Only needed for RHEV 3.3 - After Updating to 3.4 we dont need this anymore
62 | # sleep(30)
63 | #
64 | # htmlactivatehd = ""
65 | # $evm.log("info", "htmlactivatehd = #{htmlactivatehd}")
66 | # resource = RestClient::Resource.new(rhevmhost, :user => rhevmuser, :password => rhevmpass, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
67 | # data = Nokogiri::XML(resource["/api/vms/" + vmuid + "/disks/" + diskid + "/activate"].post(htmlactivatehd, :content_type => 'application/xml', :accept => 'application/xml'))
68 | # return data
69 | end
70 |
71 | begin
72 | @method = 'attachhd'
73 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Started")
74 |
75 | vm=$evm.root['vm']
76 | ext_mgt_system = vm.ext_management_system
77 |
78 | rhevmhost = "https://#{ext_mgt_system.hostname}"
79 | rhevmuser = ext_mgt_system.authentication_userid
80 | rhevmpass = ext_mgt_system.authentication_password
81 |
82 | vm=$evm.root['vm']
83 | vmuid=vm.uid_ems
84 | vmtype=vm.type
85 |
86 | unless vmtype == "ManageIQ::Providers::Redhat::InfraManager::Vm"
87 | $evm.log("info", "#{@method} - VM Type != RHEV")
88 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Ended")
89 | exit MIQ_OK
90 | end
91 | storage = $evm.root['dialog_datastore']
92 | size = $evm.root['dialog_size']
93 | allocpolicy = $evm.root['dialog_allocpolicy']
94 | $evm.log("info", "#{@method} - storage = #{storage}")
95 | $evm.log("info", "#{@method} - size = #{size}")
96 | $evm.log("info", "#{@method} - vmuid = #{vmuid}")
97 | $evm.log("info", "#{@method} - Allocation Policy = #{allocpolicy}")
98 | attachhd(rhevmhost,rhevmuser,rhevmpass,vmuid,storage,size,allocpolicy)
99 |
100 | #
101 | # Exit method
102 | #
103 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Ended")
104 | exit MIQ_OK
105 |
106 | #
107 | # Set Ruby rescue behavior
108 | #
109 | rescue => err
110 | $evm.log("error", "#{@method} - [#{err}]\n#{err.backtrace.join("\n")}")
111 | exit MIQ_ABORT
112 | end
113 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/__methods__/hot_add_disk.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: hot_add_disk
7 | display_name: hot_add_disk
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/__methods__/hot_add_nic.rb:
--------------------------------------------------------------------------------
1 | ###################################
2 | #
3 | # This method creates an additional network interface and attaches it to the VM
4 | #
5 | # Copyright (C) 2016, Christian Jung
6 | # This program is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # This program is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with this program. If not, see .
18 | #
19 | ###################################
20 |
21 | def getprofileid(rhevmhost,rhevmuser,rhevmpass,networkid)
22 | require 'rubygems'
23 | require 'rest_client'
24 | require 'nokogiri'
25 |
26 | $evm.log("info", "#{@method} - Retrieve Profile ID for Network ID: #{networkid}")
27 |
28 | resource = RestClient::Resource.new(rhevmhost, :user => rhevmuser, :password => rhevmpass, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
29 | profile_id = Nokogiri::XML(resource["/api/networks/" + networkid + "/vnicprofiles/"].get.body)
30 | id = profile_id.xpath("//vnic_profile").attr('id')
31 | return id
32 | end
33 |
34 | def attachnic(rhevmhost,rhevmuser,rhevmpass,vmuid,networkid,nicname)
35 | require 'rubygems'
36 | require 'rest_client'
37 | require 'nokogiri'
38 |
39 | profile_id = getprofileid(rhevmhost,rhevmuser,rhevmpass,networkid)
40 |
41 | nicdata = "#{profile_id}#{nicname}"
42 |
43 | $evm.log("info", "#{@method} - html = #{nicdata}")
44 | resource = RestClient::Resource.new(rhevmhost, :user => rhevmuser, :password => rhevmpass, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
45 | Nokogiri::XML(resource["/api/vms/" + vmuid + "/nics/"].post(nicdata, :content_type => 'application/xml', :accept => 'application/xml').body)
46 | return
47 | end
48 |
49 | begin
50 | @method = 'attachnic'
51 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Started")
52 |
53 | vm=$evm.root['vm']
54 | ext_mgt_system = vm.ext_management_system
55 |
56 | rhevmhost = "https://#{ext_mgt_system.hostname}"
57 | rhevmuser = ext_mgt_system.authentication_userid
58 | rhevmpass = ext_mgt_system.authentication_password
59 |
60 | vmuid=vm.uid_ems
61 | vmtype=vm.type
62 |
63 | unless vmtype == "ManageIQ::Providers::Redhat::InfraManager::Vm"
64 | $evm.log("info", "#{@method} - VM Type != RHEV")
65 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Ended")
66 | exit MIQ_OK
67 | end
68 | networkid = $evm.root['dialog_network']
69 | nicname = $evm.root['dialog_nicname']
70 | $evm.log("info", "#{@method} - network = #{networkid}")
71 | $evm.log("info", "#{@method} - vmuid = #{vmuid}")
72 | $evm.log("info", "#{@method} - nic name: #{nicname}")
73 | attachnic(rhevmhost,rhevmuser,rhevmpass,vmuid,networkid,nicname)
74 |
75 | #
76 | # Exit method
77 | #
78 | $evm.log("info", "#{@method} - EVM Automate Method: <#{@method}> Ended")
79 | exit MIQ_OK
80 |
81 | #
82 | # Set Ruby rescue behavior
83 | #
84 | rescue => err
85 | $evm.log("error", "#{@method} - [#{err}]\n#{err.backtrace.join("\n")}")
86 | exit MIQ_ABORT
87 | end
88 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/__methods__/hot_add_nic.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: hot_add_nic
7 | display_name: hot_add_nic
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/dialog_add_disk.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: dialog_add_disk
7 | name: dialog_add_disk
8 | inherits:
9 | description: dialog_add_disk
10 | fields:
11 | - execute:
12 | value: dialog_add_disk
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/dialog_add_nic.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: dialog_add_nic
7 | name: dialog_add_nic
8 | inherits:
9 | description: dialog_add_nic
10 | fields:
11 | - execute:
12 | value: dialog_add_nic
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/hot_add_disk.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: hot_add_disk
7 | name: hot_add_disk
8 | inherits:
9 | description: hot_add_disk
10 | fields:
11 | - execute:
12 | value: hot_add_disk
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/reconfigure_vm.class/hot_add_nic.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: hot_add_nic
7 | name: hot_add_nic
8 | inherits:
9 | description: hot_add_nic
10 | fields:
11 | - execute:
12 | value: hot_add_nic
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/__class__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: class
3 | version: 1.0
4 | object:
5 | attributes:
6 | description: snapshots
7 | display_name: snapshots
8 | name: snapshots
9 | type:
10 | inherits:
11 | visibility:
12 | owner:
13 | schema:
14 | - field:
15 | aetype: method
16 | name: execute
17 | display_name:
18 | datatype: string
19 | priority: 1
20 | owner:
21 | default_value:
22 | substitute: true
23 | message: create
24 | visibility:
25 | collect:
26 | scope:
27 | description:
28 | condition:
29 | on_entry:
30 | on_exit:
31 | on_error:
32 | max_retries:
33 | max_time:
34 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/__methods__/create_snapshot.rb:
--------------------------------------------------------------------------------
1 | #
2 | # create_snapshot.rb
3 | # Description: create a snapshot of the selected VM
4 | #
5 | require 'rest-client'
6 | require 'json'
7 | require 'openssl'
8 |
9 | def call_rhevm(ext_mgt_system, uri, type=:get, payload=nil)
10 | params = {
11 | :method => type,
12 | :url => "https://#{ext_mgt_system[:hostname]}#{uri}",
13 | :user => ext_mgt_system.authentication_userid,
14 | :password => ext_mgt_system.authentication_password,
15 | :headers => { :accept => :json, :content_type => :json },
16 | :verify_ssl => OpenSSL::SSL::VERIFY_NONE
17 | }
18 | params[:payload] = JSON.generate(payload) if payload
19 | return JSON.parse(RestClient::Request.new(params).execute)
20 | end
21 |
22 | $evm.log("info", "Begin Automate Method")
23 |
24 | ext_mgt_system = $evm.root['vm'].ext_management_system
25 |
26 | $evm.log("info", "Got ext_management_system #{ext_mgt_system.name}")
27 |
28 | vm=$evm.root["vm"]
29 | vmuuid=vm["uid_ems"]
30 | $evm.log("info", "RHEV UUID: #{vmuuid}")
31 |
32 | payload = {
33 | :description => $evm.root["dialog_snapshot_name"]
34 | }
35 |
36 | $evm.log("info", "Calling /api/vms/#{vmuuid}/snapshots/ with payload #{payload}")
37 | create_snapshot = call_rhevm(ext_mgt_system, "/api/vms/#{vmuuid}/snapshots/", :post, payload)
38 |
39 | $evm.log("info", "End Automate Method")
40 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/__methods__/create_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: create_snapshot
7 | display_name: create_snapshot
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/__methods__/delete_snapshot.rb:
--------------------------------------------------------------------------------
1 | #
2 | # delete_snapshot.rb
3 | # Description: delete a snapshot of the selected VM
4 | #
5 | require 'rest-client'
6 | require 'json'
7 | require 'openssl'
8 |
9 | def call_rhevm(ext_mgt_system, uri, type=:get, payload=nil)
10 | params = {
11 | :method => type,
12 | :url => "https://#{ext_mgt_system[:hostname]}#{uri}",
13 | :user => ext_mgt_system.authentication_userid,
14 | :password => ext_mgt_system.authentication_password,
15 | :headers => { :accept => :json, :content_type => :json },
16 | :verify_ssl => OpenSSL::SSL::VERIFY_NONE
17 | }
18 | params[:payload] = JSON.generate(payload) if payload
19 | return JSON.parse(RestClient::Request.new(params).execute)
20 | end
21 |
22 | $evm.log("info", "Begin Automate Method")
23 |
24 | ext_mgt_system = $evm.root['vm'].ext_management_system
25 |
26 | $evm.log("info", "Got ext_management_system #{ext_mgt_system.name}")
27 |
28 | vm=$evm.root["vm"]
29 | vmuuid=vm["uid_ems"]
30 | $evm.log("info", "RHEV UUID: #{vmuuid}")
31 |
32 | snapshotid=$evm.root["dialog_snapshot_name"]
33 |
34 | $evm.log("info", "Calling DELETE on /api/vms/#{vmuuid}/snapshots/#{snapshotid}")
35 | create_snapshot = call_rhevm(ext_mgt_system, "/api/vms/#{vmuuid}/snapshots/#{snapshotid}", :delete)
36 |
37 | $evm.log("info", "End Automate Method")
38 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/__methods__/delete_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: delete_snapshot
7 | display_name: delete_snapshot
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/__methods__/dialog_list_snapshots.rb:
--------------------------------------------------------------------------------
1 | #
2 | # dialog_list_snapshots.rb
3 | # Description: Retrieve a list of available snapshots for the selected VM
4 | # To be used in a dynamic dropdown list
5 | #
6 | require 'rest-client'
7 | require 'json'
8 | require 'openssl'
9 |
10 | def call_rhevm(ext_mgt_system, uri, type=:get, payload=nil)
11 | params = {
12 | :method => type,
13 | :url => "https://#{ext_mgt_system[:hostname]}#{uri}",
14 | :user => ext_mgt_system.authentication_userid,
15 | :password => ext_mgt_system.authentication_password,
16 | :headers => { :accept => :json, :content_type => :json },
17 | :verify_ssl => OpenSSL::SSL::VERIFY_NONE
18 | }
19 | params[:payload] = JSON.generate(payload) if payload
20 | return JSON.parse(RestClient::Request.new(params).execute)
21 | end
22 |
23 | $evm.log("info", "Begin Automate Method")
24 |
25 | ext_mgt_system = $evm.root['vm'].ext_management_system
26 |
27 | $evm.log("info", "Got ext_management_system #{ext_mgt_system.name}")
28 |
29 | vm=$evm.root["vm"]
30 | vmuuid=vm["uid_ems"]
31 | $evm.log("info", "RHEV UUID: #{vmuuid}")
32 |
33 | snapshots = call_rhevm(ext_mgt_system, "/api/vms/#{vmuuid}/snapshots/", :get)
34 |
35 | dialog_field = $evm.object
36 | # sort_by: value / description / none
37 | dialog_field["sort_by"] = "description"
38 | # sort_order: ascending / descending
39 | dialog_field["sort_order"] = "ascending"
40 | # data_type: string / integer
41 | dialog_field["data_type"] = "string"
42 | # required: true / false
43 | dialog_field["required"] = "true"
44 |
45 | snapshotlist={}
46 | snapshots["snapshot"].each do |snapshot|
47 | $evm.log("info", "Current snapshot: #{snapshot["description"]}")
48 | description=snapshot["description"]
49 | id=snapshot["id"]
50 | snapshotlist[id]=description
51 | end
52 |
53 | $evm.log("info", "Liste: #{snapshotlist}")
54 |
55 | dialog_field["values"]=snapshotlist
56 |
57 | #$evm.log("info", "Response: #{import_response.inspect}")
58 | #import_job = import_response["job"]["href"]
59 |
60 | $evm.log("info", "End Automate Method")
61 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/__methods__/dialog_list_snapshots.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: dialog_list_snapshots
7 | display_name: dialog_list_snapshots
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/__methods__/revert_snapshot.rb:
--------------------------------------------------------------------------------
1 | #
2 | # revert_snapshot.rb
3 | # Description: revert to the selected snapshot
4 | #
5 | require 'rest-client'
6 | require 'json'
7 | require 'openssl'
8 |
9 | def call_rhevm(ext_mgt_system, uri, type=:get, payload=nil)
10 | params = {
11 | :method => type,
12 | :url => "https://#{ext_mgt_system[:hostname]}#{uri}",
13 | :user => ext_mgt_system.authentication_userid,
14 | :password => ext_mgt_system.authentication_password,
15 | :headers => { :accept => :xml, :content_type => :xml },
16 | :verify_ssl => OpenSSL::SSL::VERIFY_NONE
17 | }
18 | params[:payload] = payload if payload
19 | return JSON.parse(RestClient::Request.new(params).execute)
20 | end
21 |
22 | $evm.log("info", "Begin Automate Method")
23 |
24 | ext_mgt_system = $evm.root['vm'].ext_management_system
25 |
26 | $evm.log("info", "Got ext_management_system #{ext_mgt_system.name}")
27 |
28 | vm=$evm.root["vm"]
29 | vmuuid=vm["uid_ems"]
30 | $evm.log("info", "RHEV UUID: #{vmuuid}")
31 |
32 | snapshotid=$evm.root["dialog_snapshot_name"]
33 |
34 | $evm.log("info", "Sending POST to restore action URL /api/vms/#{vmuuid}/snapshots/#{snapshotid}/restore")
35 |
36 | payload = ""
37 |
38 | create_snapshot=call_rhevm(ext_mgt_system, "/api/vms/#{vmuuid}/snapshots/#{snapshotid}/restore", :post, payload)
39 |
40 | $evm.log("info", "End Automate Method")
41 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/__methods__/revert_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: revert_snapshot
7 | display_name: revert_snapshot
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/create_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: create_snapshot
7 | name: create_snapshot
8 | inherits:
9 | description: create_snapshot
10 | fields:
11 | - execute:
12 | value: create_snapshot
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/delete_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: delete_snapshot
7 | name: delete_snapshot
8 | inherits:
9 | description: delete_snapshot
10 | fields:
11 | - execute:
12 | value: delete_snapshot
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/dialog_list_snapshots.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: dialog_list_snapshots
7 | name: dialog_list_snapshots
8 | inherits:
9 | description: dialog_list_snapshots
10 | fields:
11 | - execute:
12 | value: dialog_list_snapshots
13 |
--------------------------------------------------------------------------------
/Automate/Integration/RHEV/snapshots.class/revert_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: revert_snapshot
7 | name: revert_snapshot
8 | inherits:
9 | description: revert_snapshot
10 | fields:
11 | - execute:
12 | value: revert_snapshot
13 |
--------------------------------------------------------------------------------
/Automate/Integration/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: Integration
7 | description:
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/Automate/System/Request.class/__class__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: class
3 | version: 1.0
4 | object:
5 | attributes:
6 | description: Automation Requests
7 | display_name:
8 | name: Request
9 | type:
10 | inherits:
11 | visibility:
12 | owner:
13 | schema:
14 | - field:
15 | aetype: assertion
16 | name: guard
17 | display_name:
18 | datatype:
19 | priority: 1
20 | owner:
21 | default_value:
22 | substitute: true
23 | message: create
24 | visibility:
25 | collect:
26 | scope:
27 | description:
28 | condition:
29 | on_entry:
30 | on_exit:
31 | on_error:
32 | max_retries:
33 | max_time:
34 | - field:
35 | aetype: method
36 | name: on_entry
37 | display_name:
38 | datatype:
39 | priority: 2
40 | owner:
41 | default_value:
42 | substitute: true
43 | message: create
44 | visibility:
45 | collect:
46 | scope:
47 | description:
48 | condition:
49 | on_entry:
50 | on_exit:
51 | on_error:
52 | max_retries:
53 | max_time:
54 | - field:
55 | aetype: relationship
56 | name: rel1
57 | display_name:
58 | datatype:
59 | priority: 3
60 | owner:
61 | default_value:
62 | substitute: true
63 | message: create
64 | visibility:
65 | collect:
66 | scope:
67 | description:
68 | condition:
69 | on_entry:
70 | on_exit:
71 | on_error:
72 | max_retries:
73 | max_time:
74 | - field:
75 | aetype: method
76 | name: meth1
77 | display_name:
78 | datatype:
79 | priority: 4
80 | owner:
81 | default_value:
82 | substitute: true
83 | message: create
84 | visibility:
85 | collect:
86 | scope:
87 | description:
88 | condition:
89 | on_entry:
90 | on_exit:
91 | on_error:
92 | max_retries:
93 | max_time:
94 | - field:
95 | aetype: relationship
96 | name: rel2
97 | display_name:
98 | datatype:
99 | priority: 5
100 | owner:
101 | default_value:
102 | substitute: true
103 | message: create
104 | visibility:
105 | collect:
106 | scope:
107 | description:
108 | condition:
109 | on_entry:
110 | on_exit:
111 | on_error:
112 | max_retries:
113 | max_time:
114 | - field:
115 | aetype: method
116 | name: meth2
117 | display_name:
118 | datatype:
119 | priority: 6
120 | owner:
121 | default_value:
122 | substitute: true
123 | message: create
124 | visibility:
125 | collect:
126 | scope:
127 | description:
128 | condition:
129 | on_entry:
130 | on_exit:
131 | on_error:
132 | max_retries:
133 | max_time:
134 | - field:
135 | aetype: relationship
136 | name: rel3
137 | display_name:
138 | datatype:
139 | priority: 7
140 | owner:
141 | default_value:
142 | substitute: true
143 | message: create
144 | visibility:
145 | collect:
146 | scope:
147 | description:
148 | condition:
149 | on_entry:
150 | on_exit:
151 | on_error:
152 | max_retries:
153 | max_time:
154 | - field:
155 | aetype: method
156 | name: meth3
157 | display_name:
158 | datatype:
159 | priority: 8
160 | owner:
161 | default_value:
162 | substitute: true
163 | message: create
164 | visibility:
165 | collect:
166 | scope:
167 | description:
168 | condition:
169 | on_entry:
170 | on_exit:
171 | on_error:
172 | max_retries:
173 | max_time:
174 | - field:
175 | aetype: relationship
176 | name: rel4
177 | display_name:
178 | datatype:
179 | priority: 9
180 | owner:
181 | default_value:
182 | substitute: true
183 | message: create
184 | visibility:
185 | collect:
186 | scope:
187 | description:
188 | condition:
189 | on_entry:
190 | on_exit:
191 | on_error:
192 | max_retries:
193 | max_time:
194 | - field:
195 | aetype: method
196 | name: meth4
197 | display_name:
198 | datatype:
199 | priority: 10
200 | owner:
201 | default_value:
202 | substitute: true
203 | message: create
204 | visibility:
205 | collect:
206 | scope:
207 | description:
208 | condition:
209 | on_entry:
210 | on_exit:
211 | on_error:
212 | max_retries:
213 | max_time:
214 | - field:
215 | aetype: relationship
216 | name: rel5
217 | display_name:
218 | datatype:
219 | priority: 11
220 | owner:
221 | default_value:
222 | substitute: true
223 | message: create
224 | visibility:
225 | collect:
226 | scope:
227 | description:
228 | condition:
229 | on_entry:
230 | on_exit:
231 | on_error:
232 | max_retries:
233 | max_time:
234 | - field:
235 | aetype: method
236 | name: meth5
237 | display_name:
238 | datatype:
239 | priority: 12
240 | owner:
241 | default_value:
242 | substitute: true
243 | message: create
244 | visibility:
245 | collect:
246 | scope:
247 | description:
248 | condition:
249 | on_entry:
250 | on_exit:
251 | on_error:
252 | max_retries:
253 | max_time:
254 | - field:
255 | aetype: relationship
256 | name: rel6
257 | display_name:
258 | datatype:
259 | priority: 13
260 | owner:
261 | default_value:
262 | substitute: true
263 | message: create
264 | visibility:
265 | collect:
266 | scope:
267 | description:
268 | condition:
269 | on_entry:
270 | on_exit:
271 | on_error:
272 | max_retries:
273 | max_time:
274 | - field:
275 | aetype: method
276 | name: meth6
277 | display_name:
278 | datatype:
279 | priority: 14
280 | owner:
281 | default_value:
282 | substitute: true
283 | message: create
284 | visibility:
285 | collect:
286 | scope:
287 | description:
288 | condition:
289 | on_entry:
290 | on_exit:
291 | on_error:
292 | max_retries:
293 | max_time:
294 | - field:
295 | aetype: relationship
296 | name: rel7
297 | display_name:
298 | datatype:
299 | priority: 15
300 | owner:
301 | default_value:
302 | substitute: true
303 | message: create
304 | visibility:
305 | collect:
306 | scope:
307 | description:
308 | condition:
309 | on_entry:
310 | on_exit:
311 | on_error:
312 | max_retries:
313 | max_time:
314 | - field:
315 | aetype: method
316 | name: meth7
317 | display_name:
318 | datatype:
319 | priority: 16
320 | owner:
321 | default_value:
322 | substitute: true
323 | message: create
324 | visibility:
325 | collect:
326 | scope:
327 | description:
328 | condition:
329 | on_entry:
330 | on_exit:
331 | on_error:
332 | max_retries:
333 | max_time:
334 | - field:
335 | aetype: relationship
336 | name: rel8
337 | display_name:
338 | datatype:
339 | priority: 17
340 | owner:
341 | default_value:
342 | substitute: true
343 | message: create
344 | visibility:
345 | collect:
346 | scope:
347 | description:
348 | condition:
349 | on_entry:
350 | on_exit:
351 | on_error:
352 | max_retries:
353 | max_time:
354 | - field:
355 | aetype: method
356 | name: meth8
357 | display_name:
358 | datatype:
359 | priority: 18
360 | owner:
361 | default_value:
362 | substitute: true
363 | message: create
364 | visibility:
365 | collect:
366 | scope:
367 | description:
368 | condition:
369 | on_entry:
370 | on_exit:
371 | on_error:
372 | max_retries:
373 | max_time:
374 | - field:
375 | aetype: relationship
376 | name: rel9
377 | display_name:
378 | datatype:
379 | priority: 19
380 | owner:
381 | default_value:
382 | substitute: true
383 | message: create
384 | visibility:
385 | collect:
386 | scope:
387 | description:
388 | condition:
389 | on_entry:
390 | on_exit:
391 | on_error:
392 | max_retries:
393 | max_time:
394 | - field:
395 | aetype: method
396 | name: on_exit
397 | display_name:
398 | datatype:
399 | priority: 20
400 | owner:
401 | default_value:
402 | substitute: true
403 | message: create
404 | visibility:
405 | collect:
406 | scope:
407 | description:
408 | condition:
409 | on_entry:
410 | on_exit:
411 | on_error:
412 | max_retries:
413 | max_time:
414 |
--------------------------------------------------------------------------------
/Automate/System/Request.class/create_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: create_snapshot
7 | name: create_snapshot
8 | inherits:
9 | description: create_snapshot
10 | fields:
11 | - rel3:
12 | value: "/Integration/RHEV/snapshots/create_snapshot"
13 |
--------------------------------------------------------------------------------
/Automate/System/Request.class/delete_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: delete_snapshot
7 | name: delete_snapshot
8 | inherits:
9 | description: delete_snapshot
10 | fields:
11 | - rel3:
12 | value: "/Integration/RHEV/snapshots/delete_snapshot"
13 |
--------------------------------------------------------------------------------
/Automate/System/Request.class/hot_add_disk.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: hot_add_disk
7 | name: hot_add_disk
8 | inherits:
9 | description: hot_add_disk
10 | fields:
11 | - rel2:
12 | value: "/Integration/RHEV/reconfigure_vm/hot_add_disk"
13 |
--------------------------------------------------------------------------------
/Automate/System/Request.class/hot_add_nic.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: hot_add_nic
7 | name: hot_add_nic
8 | inherits:
9 | description: hot_add_nic
10 | fields:
11 | - rel2:
12 | value: "/Integration/RHEV/reconfigure_vm/hot_add_nic"
13 |
--------------------------------------------------------------------------------
/Automate/System/Request.class/revert_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: revert_snapshot
7 | name: revert_snapshot
8 | inherits:
9 | description: revert_snapshot
10 | fields:
11 | - rel3:
12 | value: "/Integration/RHEV/snapshots/revert_snapshot"
13 |
--------------------------------------------------------------------------------
/Automate/System/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: System
7 | description:
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/Automate/__domain__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: domain
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: cjung-git
7 | description: cjung-git
8 | display_name:
9 | system: false
10 | priority: 2
11 | enabled: true
12 | tenant_id: 99000000000001
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
676 |
--------------------------------------------------------------------------------
/OpenStack/HEAT/README.md:
--------------------------------------------------------------------------------
1 | # About this template
2 |
3 | This is a copy from https://github.com/openstack/heat-templates/tree/master/hot/software-config/example-templates/wordpress
4 |
5 | But it has some fixes required by CloudForms and later versions of OpenStack
6 |
7 |
--------------------------------------------------------------------------------
/OpenStack/HEAT/WordPress_Native.yaml:
--------------------------------------------------------------------------------
1 | heat_template_version: 2013-05-23
2 |
3 | description: >
4 | Heat WordPress template to support F20, using only Heat OpenStack-native
5 | resource types, and without the requirement for heat-cfntools in the image.
6 | WordPress is web software you can use to create a beautiful website or blog.
7 | This template installs a single-instance WordPress deployment using a local
8 | MySQL database to store the data.
9 |
10 | parameters:
11 |
12 | key_name:
13 | type: string
14 | description: Name of a KeyPair to enable SSH access to the instance
15 | default: demo-user
16 | instance_type:
17 | type: string
18 | description: Instance type for WordPress server
19 | default: m1.small
20 | image_id:
21 | type: string
22 | description: >
23 | Name or ID of the image to use for the WordPress server.
24 | Recommended values are fedora-20.i386 or fedora-20.x86_64;
25 | get them from http://cloud.fedoraproject.org/fedora-20.i386.qcow2
26 | or http://cloud.fedoraproject.org/fedora-20.x86_64.qcow2 .
27 | default: fedora-20.x86_64
28 | network:
29 | type: string
30 | description: Network used by the server
31 | default: private
32 | db_name:
33 | type: string
34 | description: WordPress database name
35 | default: wordpress
36 | constraints:
37 | - length: { min: 1, max: 64 }
38 | description: db_name must be between 1 and 64 characters
39 | - allowed_pattern: '[a-zA-Z][a-zA-Z0-9]*'
40 | description: >
41 | db_name must begin with a letter and contain only alphanumeric
42 | characters
43 | db_username:
44 | type: string
45 | description: The WordPress database admin account username
46 | default: admin
47 | hidden: true
48 | constraints:
49 | - length: { min: 1, max: 16 }
50 | description: db_username must be between 1 and 16 characters
51 | - allowed_pattern: '[a-zA-Z][a-zA-Z0-9]*'
52 | description: >
53 | db_username must begin with a letter and contain only alphanumeric
54 | characters
55 | db_password:
56 | type: string
57 | description: The WordPress database admin account password
58 | default: admin
59 | hidden: true
60 | constraints:
61 | - length: { min: 1, max: 41 }
62 | description: db_password must be between 1 and 41 characters
63 | - allowed_pattern: '[a-zA-Z0-9]*'
64 | description: db_password must contain only alphanumeric characters
65 | db_root_password:
66 | type: string
67 | description: Root password for MySQL
68 | default: admin
69 | hidden: true
70 | constraints:
71 | - length: { min: 1, max: 41 }
72 | description: db_root_password must be between 1 and 41 characters
73 | - allowed_pattern: '[a-zA-Z0-9]*'
74 | description: db_root_password must contain only alphanumeric characters
75 |
76 | resources:
77 | wordpress_instance:
78 | type: OS::Nova::Server
79 | properties:
80 | image: { get_param: image_id }
81 | flavor: { get_param: instance_type }
82 | key_name: { get_param: key_name }
83 | networks: [{network: {get_param: network} }]
84 | user_data:
85 | str_replace:
86 | template: |
87 | #!/bin/bash -v
88 |
89 | yum -y install mariadb mariadb-server httpd wordpress
90 | touch /var/log/mariadb/mariadb.log
91 | chown mysql.mysql /var/log/mariadb/mariadb.log
92 | systemctl start mariadb.service
93 |
94 | # Setup MySQL root password and create a user
95 | mysqladmin -u root password db_rootpassword
96 | cat << EOF | mysql -u root --password=db_rootpassword
97 | CREATE DATABASE db_name;
98 | GRANT ALL PRIVILEGES ON db_name.* TO "db_user"@"localhost"
99 | IDENTIFIED BY "db_password";
100 | FLUSH PRIVILEGES;
101 | EXIT
102 | EOF
103 |
104 | sed -i "/Deny from All/d" /etc/httpd/conf.d/wordpress.conf
105 | sed -i "s/Require local/Require all granted/" /etc/httpd/conf.d/wordpress.conf
106 | sed -i s/database_name_here/db_name/ /etc/wordpress/wp-config.php
107 | sed -i s/username_here/db_user/ /etc/wordpress/wp-config.php
108 | sed -i s/password_here/db_password/ /etc/wordpress/wp-config.php
109 |
110 | systemctl start httpd.service
111 | params:
112 | db_rootpassword: { get_param: db_root_password }
113 | db_name: { get_param: db_name }
114 | db_user: { get_param: db_username }
115 | db_password: { get_param: db_password }
116 |
117 | outputs:
118 | WebsiteURL:
119 | description: URL for Wordpress wiki
120 | value:
121 | str_replace:
122 | template: http://host/wordpress
123 | params:
124 | host: { get_attr: [wordpress_instance, first_address] }
125 |
--------------------------------------------------------------------------------
/OpenStack/create_lbaas.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Description: Create LBaaS for the selected service
3 | #
4 |
5 | @method = 'create_lbaas'
6 |
7 | $evm.log("info", "#{@method} - EVM Automate Method Started")
8 |
9 | require 'rest-client'
10 | require 'json'
11 | require 'fog'
12 |
13 | # hardcoding tenant_id
14 | tenant_id = "1234567890"
15 |
16 | # hardcoding subnet_id
17 | subnet_id = "1234567890"
18 |
19 | # also the pool ID for the floating IPs is static
20 | floating_pool_id = "1234567890"
21 |
22 | # and we also always use the same health monitor
23 | health_monitor_id = "1234567890"
24 |
25 | # create the list of VMs
26 | vmlist = []
27 | service = nil
28 |
29 | if not $evm.root['service'].nil?
30 | service = $evm.root['service']
31 | end
32 |
33 | if not $evm.root['service_template_provision_task'].nil?
34 | service = $evm.root['service_template_provision_task'].destination
35 | end
36 |
37 | if service.nil?
38 | $evm.log("info", "#{@method} - unable to find service object")
39 | exit MIQ_ABORT
40 | end
41 |
42 | # if this is a service catalog item, VMs are direct children
43 | if not service.direct_vms.nil?
44 | if service.direct_vms.length > 0
45 | vmlist = service.direct_vms
46 | end
47 | end
48 |
49 | # if this is a service catalog bundle, VMs are indirect children
50 | if not service.indirect_vms.nil?
51 | if service.indirect_vms.length > 0
52 | vmlist = service.indirect_vms
53 | end
54 | end
55 |
56 | $evm.log("info", "#{@method} - List of VMs found: #{vmlist.inspect}")
57 | vm = vmlist.first
58 |
59 | ext_mgt_system=vm.ext_management_system
60 |
61 | # get the MAC address directly from OSP
62 | # change the tenant name or make it dynamic
63 | credentials={
64 | :provider => "OpenStack",
65 | :openstack_api_key => ext_mgt_system.authentication_password,
66 | :openstack_username => ext_mgt_system.authentication_userid,
67 | :openstack_auth_url => "http://#{ext_mgt_system[:hostname]}:#{ext_mgt_system[:port]}/v2.0/tokens",
68 | :openstack_tenant => "admin"
69 | }
70 |
71 | compute = Fog::Compute.new(credentials)
72 | neutron = Fog::Network.new(credentials)
73 |
74 | poolname = service.name
75 |
76 | # create LB Pool
77 | $evm.log("info", "#{@method} - Creating Load Balancer Pool #{poolname}")
78 | response = neutron.create_lb_pool subnet_id, "HTTP", "ROUND_ROBIN", { :description => poolname , :name => poolname, :tenant_id => tenant_id}
79 | $evm.log("info", "#{@method} - Response: #{response.inspect}")
80 | pool_id = response[:body]['pool']['id']
81 | $evm.log("info", "#{@method} - Pool ID: #{pool_id}")
82 |
83 | # create LB members and add to Pool
84 | vmlist.each { |vm|
85 | # do not add the mysql server to the pool
86 | if vm.name.include?("mysql")
87 | next
88 | end
89 |
90 | vmfloatingip = vm.custom_get("NEUTRON_floating_ip")
91 | vmipaddress = nil
92 |
93 | vm.ipaddresses.each { |ip|
94 | if vmfloatingip != ip
95 | $evm.log("info", "#{@method} - #{vmfloatingip} does not match with #{ip}, so it must be the subnet IP")
96 | vmipaddress = ip
97 | break
98 | else
99 | $evm.log("info", "#{@method} - #{vmfloatingip} and #{ip} do match, skipping")
100 | end
101 | }
102 |
103 | if vmipaddress.nil?
104 | $evm.log("info", "#{@method} - Did not find floating IP for VM #{vm.name} in custom attribute")
105 | exit MIQ_ABORT
106 | end
107 |
108 | $evm.log("info", "#{@method} - Adding Member #{vm.name} with IP #{vmipaddress} to pool with ID #{pool_id}")
109 | response = neutron.create_lb_member pool_id, vmipaddress, 8080, 200
110 | $evm.log("info", "#{@method} - Response: #{response.inspect}")
111 | }
112 |
113 | # associate health monitor
114 | $evm.log("info", "#{@method} - Associating Health Monitor with ID #{health_monitor_id} to Pool with ID #{pool_id}")
115 | response = neutron.associate_lb_health_monitor pool_id, health_monitor_id
116 | $evm.log("info", "#{@method} - Response: #{response.inspect}")
117 |
118 | # create a VIP
119 | $evm.log("info", "#{@method} - Creating VIP")
120 | response = neutron.create_lb_vip subnet_id, pool_id, "HTTP", 8080
121 | $evm.log("info", "#{@method} - Response: #{response.inspect}")
122 | vip_id = response[:body]['vip']['id']
123 | port_id = response[:body]['vip']['port_id']
124 | $evm.log("info", "#{@method} - VIP ID: #{vip_id} and Port ID: #{port_id}")
125 |
126 | # allocate floating IP
127 | $evm.log("info", "#{@method} - Allocating Floating IP")
128 | response = compute.allocate_address floating_pool_id
129 | $evm.log("info", "#{@method} - Response: #{response.inspect}")
130 | allocated_ip_id = response[:body]['floating_ip']['id']
131 | allocated_ip = response[:body]['floating_ip']['ip']
132 | service.custom_set('Floating IP',allocated_ip)
133 | $evm.log("info", "#{@method} - Floating IP ID: #{allocated_ip_id}")
134 |
135 | # associate floating IP to VIP
136 | $evm.log("info", "#{@method} - Associating Floating IP with ID #{allocated_ip_id} to Port with ID #{port_id}")
137 | response = neutron.associate_floating_ip allocated_ip_id, port_id
138 | $evm.log("info", "#{@method} - Response: #{response.inspect}")
139 |
140 | exit MIQ_OK
141 |
--------------------------------------------------------------------------------
/OpenStack/create_service_snapshot.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Description: This method will create a snapshot on OpenStack for each VM belonging to a given service
3 | #
4 |
5 | begin
6 | @method = 'create_service_snapshot'
7 | $evm.log("info", "#{@method} - EVM Automate Method Started")
8 |
9 | @debug = false
10 |
11 | require 'rest-client'
12 | require 'json'
13 | require 'fog'
14 |
15 | # create the list of VMs
16 | vmlist = []
17 | # if this is a service catalog item, VMs are direct children
18 | if $evm.root['service'].direct_vms.length > 0
19 | vmlist = $evm.root['service'].direct_vms
20 | end
21 |
22 | # if this is a service catalog bundle, VMs are indirect children
23 | if $evm.root['service'].indirect_vms.length > 0
24 | vmlist = $evm.root['service'].indirect_vms
25 | end
26 |
27 | snapshotlist={}
28 | credentials=nil
29 | ext_mgt_system=nil
30 |
31 | vmlist.each { |vm|
32 | $evm.log("info", "#{@method} - VM Name: #{vm.name}")
33 |
34 | ext_mgt_system=vm.ext_management_system
35 |
36 | # the openstack_tenant might have to be adjusted or be dynamic
37 | credentials={
38 | :provider => "OpenStack",
39 | :openstack_api_key => ext_mgt_system.authentication_password,
40 | :openstack_username => ext_mgt_system.authentication_userid,
41 | :openstack_auth_url => "http://#{ext_mgt_system[:hostname]}:#{ext_mgt_system[:port]}/v2.0/tokens",
42 | :openstack_tenant => "admin"
43 | }
44 |
45 | compute = Fog::Compute.new(credentials)
46 |
47 | server = compute.servers.get(vm.ems_ref)
48 |
49 | response = server.create_image "snapshot-#{server.name}", :metadata => { :environment => 'development' }
50 |
51 | image_id = response.body["image"]["id"]
52 |
53 | $evm.log("info", "#{@method} - Created Snapshot named snapshot-#{server.name} with ID #{image_id}")
54 |
55 | vm.custom_set("Snapshot ID",image_id)
56 | vm.custom_set("Snapshot Name","snapshot-#{server.name}")
57 | }
58 |
59 | #
60 | # Exit method
61 | #
62 | $evm.log("info", "#{@method} - EVM Automate Method Ended")
63 | exit MIQ_OK
64 |
65 | #
66 | # Set Ruby rescue behavior
67 | #
68 | rescue => err
69 | $evm.log("error", "#{@method} - [#{err}]\n#{err.backtrace.join("\n")}")
70 | exit MIQ_ABORT
71 | end
72 |
--------------------------------------------------------------------------------
/OpenStack/create_snapshot.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Description: Create snapshot of currently selected instance
3 | #
4 |
5 | @method = 'create_snapshot'
6 |
7 | $evm.log("info", "#{@method} - EVM Automate Method Started")
8 |
9 | require 'rest-client'
10 | require 'json'
11 | require 'fog'
12 |
13 | vm = $evm.root['vm']
14 |
15 | ext_mgt_system=vm.ext_management_system
16 |
17 | # get the MAC address directly from OSP
18 | # make sure to adjust the openstack_tenant or make it dynamic
19 | credentials={
20 | :provider => "OpenStack",
21 | :openstack_api_key => ext_mgt_system.authentication_password,
22 | :openstack_username => ext_mgt_system.authentication_userid,
23 | :openstack_auth_url => "http://#{ext_mgt_system[:hostname]}:#{ext_mgt_system[:port]}/v2.0/tokens",
24 | :openstack_tenant => "admin"
25 | }
26 |
27 | $evm.log("info", "#{@method} - Logging into to http://#{ext_mgt_system[:hostname]}:#{ext_mgt_system[:port]}/v2.0/tokens as #{ext_mgt_system.authentication_userid}")
28 |
29 | compute = Fog::Compute.new(credentials)
30 |
31 | server = compute.servers.get(vm.ems_ref)
32 |
33 | response = server.create_image "snapshot-#{server.name}", :metadata => { :environment => 'development' }
34 |
35 | image_id = response.body["image"]["id"]
36 |
37 | $evm.log("info", "#{@method} - Created Snapshot named snapshot-#{server.name} with ID #{image_id}")
38 |
39 | vm.custom_set("Snapshot ID",image_id)
40 | vm.custom_set("Snapshot Name","snapshot-#{server.name}")
41 |
42 | exit MIQ_OK
43 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ManageIQ
2 | my personal scripts for ManageIQ and/or CloudForms
3 |
--------------------------------------------------------------------------------
/check_puppet/README.md:
--------------------------------------------------------------------------------
1 | more details on how to use this script can be found here: http://www.jung-christian.de/2015/06/check-provisioning-state-in-manageiq-with-foreman/
2 |
--------------------------------------------------------------------------------
/check_puppet/checkpuppet.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Description: Wait for Puppet to report that configuration is complete
3 | # before reporting the provisioning is complete.
4 | #
5 |
6 | require 'json'
7 | require 'rest-client'
8 | require 'uri'
9 | require 'openssl'
10 | require 'base64'
11 |
12 | def retry_method(msg, retry_interval = 60)
13 | $evm.log("info", "Retrying current state: [#{msg}]")
14 | $evm.root['ae_result'] = 'retry'
15 | $evm.root['ae_reason'] = msg.to_s
16 | $evm.root['ae_retry_interval'] = retry_interval
17 | exit MIQ_OK
18 | end
19 |
20 | def invoke_foreman_api(uri, foreman_user, foreman_password)
21 | @headers = {
22 | :content_type => 'application/json',
23 | :accept => 'application/json;version=2',
24 | :authorization => "Basic #{Base64.strict_encode64("#{foreman_user}:#{foreman_password}")}"
25 | }
26 |
27 | request = RestClient::Request.new(
28 | method: :get,
29 | url: uri,
30 | headers: @headers,
31 | verify_ssl: OpenSSL::SSL::VERIFY_NONE
32 | )
33 |
34 | rest_result=request.execute
35 | json_parse=JSON.parse(rest_result)
36 | return json_parse
37 | end
38 |
39 | begin
40 |
41 | prov = $evm.root['miq_provision']
42 | #request = prov.miq_provision_request
43 | unless prov.source.nil?
44 | unless prov.source.platform == "linux"
45 | $evm.log("info", "Request is #{prov.source.platform}, not Linux, skipping foreman registration.")
46 | exit MIQ_OK
47 | end
48 | end
49 |
50 | foreman_host = $evm.object['foreman_host']
51 | foreman_user = $evm.object['foreman_user']
52 | foreman_password = $evm.object.decrypt('foreman_password')
53 | base_url = "https://#{foreman_host}/api/hosts/"
54 | foreman_host_id = prov.get_option(:hostid)
55 | url = "#{base_url}/#{foreman_host_id}/status"
56 | api_timeout = 60
57 | http_method = :get
58 |
59 | result = invoke_foreman_api(url, foreman_user,foreman_password)
60 | status = result['status']
61 |
62 | $evm.log("info", "Status for VM #{prov.vm.name}: #{status}")
63 |
64 | case status.downcase
65 | when 'no changes'
66 | $evm.root['ae_result'] = 'ok'
67 | $evm.log("info", "Puppet Configuration Complete")
68 | exit MIQ_OK
69 | when 'error'
70 | # in many environments the first puppet run will always fail
71 | # in this case you might want to treat the error as a non critical event instead
72 | $evm.log("error", "Puppet reported an error")
73 | $evm.root['ae_result'] = 'error'
74 | $evm.root['ae_reason'] = "Puppet reported an error"
75 | else
76 | retry_method("Waiting for Puppet Report")
77 | end
78 | end
79 |
80 |
--------------------------------------------------------------------------------
/control-policies/README.md:
--------------------------------------------------------------------------------
1 | # READ
2 |
3 | This directory contains a couple of example Control Policies to be used in CloudForms or ManageIQ.
4 |
5 | * VM-Security-Profile.yaml: Runs a Compliance Check after Smart State Analysis completed. Checking for SELinux to be configured in enforcing mode. Check this blog post for more details: [SELinux Compliance Policy](http://www.jung-christian.de/post/2017/10/control-policy-selinux/)
6 | * VM-Security-Profile-with-Ansible-Action.yaml: extension of the previous example, this time with Ansible action to fix the configuration error. A new blog post can be found with the title [Enforce SELinux Compliance Policy with Ansible](http://www.jung-christian.de/post/2017/12/enforce-selinux-with-ansible/)
7 |
--------------------------------------------------------------------------------
/control-policies/VM-Security-Profile-with-Ansible-Action.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | - MiqPolicySet:
3 | name: 8977d230-9258-11e7-a7fb-2cc2605856f4
4 | description: Security Profile
5 | set_type: MiqPolicySet
6 | guid: 8977d230-9258-11e7-a7fb-2cc2605856f4
7 | read_only:
8 | set_data:
9 | mode: control
10 | owner_type:
11 | owner_id:
12 | userid:
13 | group_id:
14 | MiqPolicy:
15 | - name: 4c0e0048-e0ac-11e7-a284-2cc2605c21bc
16 | description: Check Compliance
17 | expression:
18 | towhat: Vm
19 | guid: 4c0e0048-e0ac-11e7-a284-2cc2605c21bc
20 | created_by: admin
21 | updated_by: admin
22 | notes:
23 | active: true
24 | mode: control
25 | read_only:
26 | MiqPolicyContent:
27 | - qualifier: success
28 | success_sequence: 1
29 | success_synchronous: true
30 | MiqEventDefinition:
31 | name: vm_scan_complete
32 | description: VM Analysis Complete
33 | guid: abc6272a-dd94-11e6-8457-2cc2605deca5
34 | event_type: Default
35 | definition:
36 | default:
37 | enabled:
38 | MiqAction:
39 | name: check_compliance
40 | description: Check Host or VM Compliance
41 | guid: a9ffc626-dd94-11e6-8457-2cc2605deca5
42 | action_type: default
43 | options: {}
44 | Condition: []
45 | - name: 73db1f88-9256-11e7-a7fb-2cc2605856f4
46 | description: Check SELinux Policy
47 | expression:
48 | towhat: Vm
49 | guid: 73db1f88-9256-11e7-a7fb-2cc2605856f4
50 | created_by: demo
51 | updated_by: demo
52 | notes:
53 | active: true
54 | mode: compliance
55 | read_only:
56 | MiqPolicyContent:
57 | - qualifier: failure
58 | failure_sequence: 1
59 | failure_synchronous: true
60 | MiqEventDefinition:
61 | name: vm_compliance_check
62 | description: VM Compliance Check
63 | guid: 42b1bd96-317e-11e3-88e1-005056b80000
64 | event_type: Default
65 | definition:
66 | default:
67 | enabled:
68 | MiqAction:
69 | name: compliance_failed
70 | description: Mark as Non-Compliant
71 | guid: 339f0cc8-317e-11e3-88e1-005056b80000
72 | action_type: default
73 | options: {}
74 | - qualifier: failure
75 | failure_sequence: 2
76 | failure_synchronous: true
77 | MiqEventDefinition:
78 | name: vm_compliance_check
79 | description: VM Compliance Check
80 | guid: 42b1bd96-317e-11e3-88e1-005056b80000
81 | event_type: Default
82 | definition:
83 | default:
84 | enabled:
85 | MiqAction:
86 | name: 9a53b6be-e0aa-11e7-a284-2cc2605c21bc
87 | description: Fix SELinux
88 | guid: 9a53b6be-e0aa-11e7-a284-2cc2605c21bc
89 | action_type: custom_automation
90 | options:
91 | :use_event_target: false
92 | :use_localhost: true
93 | :ae_message: create
94 | :ae_request: ansible_tower_job
95 | :ae_hash:
96 | job_template_name: Fix SELinux
97 | Condition:
98 | - name: b047473a-9256-11e7-a7fb-2cc2605856f4
99 | description: Check for Enforcing
100 | modifier: allow
101 | expression: !ruby/object:MiqExpression
102 | exp:
103 | FIND:
104 | search:
105 | "=":
106 | field: Vm.filesystems-name
107 | value: "/etc/sysconfig/selinux"
108 | checkall:
109 | STARTS WITH:
110 | field: Vm.filesystems-contents
111 | value: SELINUX=enforcing
112 | context_type:
113 | towhat: Vm
114 | file_mtime:
115 | guid: b047473a-9256-11e7-a7fb-2cc2605856f4
116 | filename:
117 | applies_to_exp: !ruby/object:MiqExpression
118 | exp:
119 | "=":
120 | field: Vm-platform
121 | value: linux
122 | context_type:
123 | miq_policy_id:
124 | notes:
125 | read_only:
126 | - name: b5c99a10-9255-11e7-a7fb-2cc2605856f4
127 | description: Run SmartSate
128 | expression:
129 | towhat: Vm
130 | guid: b5c99a10-9255-11e7-a7fb-2cc2605856f4
131 | created_by: demo
132 | updated_by: demo
133 | notes:
134 | active: true
135 | mode: control
136 | read_only:
137 | MiqPolicyContent:
138 | - qualifier: success
139 | success_sequence: 1
140 | MiqEventDefinition:
141 | name: vm_start
142 | description: VM Power On
143 | guid: ab63fca8-dd94-11e6-8457-2cc2605deca5
144 | event_type: Default
145 | definition:
146 | default:
147 | enabled:
148 | MiqAction:
149 | name: vm_analyze
150 | description: Initiate SmartState Analysis for VM
151 | guid: a9ec4fba-dd94-11e6-8457-2cc2605deca5
152 | action_type: default
153 | options: {}
154 | - qualifier: success
155 | success_sequence: 1
156 | MiqEventDefinition:
157 | name: vm_reset
158 | description: VM Reset
159 | guid: ab70737a-dd94-11e6-8457-2cc2605deca5
160 | event_type: Default
161 | definition:
162 | default:
163 | enabled:
164 | MiqAction:
165 | name: vm_analyze
166 | description: Initiate SmartState Analysis for VM
167 | guid: a9ec4fba-dd94-11e6-8457-2cc2605deca5
168 | action_type: default
169 | options: {}
170 | Condition: []
171 |
--------------------------------------------------------------------------------
/control-policies/VM-Security-Profile.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | - MiqPolicySet:
3 | name: 908a3f34-af56-11e7-814f-2cc2605c21bc
4 | description: VM Security Profile
5 | set_type: MiqPolicySet
6 | guid: 908a3f34-af56-11e7-814f-2cc2605c21bc
7 | read_only:
8 | set_data:
9 | mode:
10 | owner_type:
11 | owner_id:
12 | userid:
13 | group_id:
14 | MiqPolicy:
15 | - name: 5ebfc018-af57-11e7-814f-2cc2605c21bc
16 | description: Compliance Check after SSA
17 | expression:
18 | towhat: Vm
19 | guid: 5ebfc018-af57-11e7-814f-2cc2605c21bc
20 | created_by: admin
21 | updated_by: admin
22 | notes:
23 | active: true
24 | mode: control
25 | read_only:
26 | MiqPolicyContent:
27 | - qualifier: success
28 | success_sequence: 1
29 | success_synchronous: true
30 | MiqEventDefinition:
31 | name: vm_scan_complete
32 | description: VM Analysis Complete
33 | guid: abc6272a-dd94-11e6-8457-2cc2605deca5
34 | event_type: Default
35 | definition:
36 | default:
37 | enabled:
38 | MiqAction:
39 | name: check_compliance
40 | description: Check Host or VM Compliance
41 | guid: a9ffc626-dd94-11e6-8457-2cc2605deca5
42 | action_type: default
43 | options: {}
44 | Condition: []
45 | - name: 0cb1b5d4-af56-11e7-814f-2cc2605c21bc
46 | description: SELinux set to Enforcing
47 | expression: !ruby/object:MiqExpression
48 | exp:
49 | "=":
50 | field: Vm-platform
51 | value: linux
52 | context_type:
53 | towhat: Vm
54 | guid: 0cb1b5d4-af56-11e7-814f-2cc2605c21bc
55 | created_by: admin
56 | updated_by: admin
57 | notes:
58 | active: true
59 | mode: compliance
60 | read_only:
61 | MiqPolicyContent:
62 | - qualifier: failure
63 | failure_sequence: 1
64 | failure_synchronous: true
65 | MiqEventDefinition:
66 | name: vm_compliance_check
67 | description: VM Compliance Check
68 | guid: 42b1bd96-317e-11e3-88e1-005056b80000
69 | event_type: Default
70 | definition:
71 | default:
72 | enabled:
73 | MiqAction:
74 | name: compliance_failed
75 | description: Mark as Non-Compliant
76 | guid: 339f0cc8-317e-11e3-88e1-005056b80000
77 | action_type: default
78 | options: {}
79 | Condition:
80 | - name: 7ed12992-af56-11e7-814f-2cc2605c21bc
81 | description: SELinux is set to Enforcing
82 | modifier: allow
83 | expression: !ruby/object:MiqExpression
84 | exp:
85 | FIND:
86 | search:
87 | "=":
88 | field: Vm.filesystems-name
89 | value: "/etc/sysconfig/selinux"
90 | checkall:
91 | STARTS WITH:
92 | field: Vm.filesystems-contents
93 | value: SELINUX=enforcing
94 | context_type:
95 | towhat: Vm
96 | file_mtime:
97 | guid: 7ed12992-af56-11e7-814f-2cc2605c21bc
98 | filename:
99 | applies_to_exp:
100 | miq_policy_id:
101 | notes:
102 | read_only:
103 |
--------------------------------------------------------------------------------
/delete_from_foreman/README.md:
--------------------------------------------------------------------------------
1 | more details on how to use this script can be found here: http://www.jung-christian.de/2015/06/delete-vm-from-foreman-during-retirement/
2 |
--------------------------------------------------------------------------------
/delete_from_foreman/deletefromforeman.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Description: Create configured host record in Foreman
3 | #
4 |
5 | @method = 'DeleteFromForeman'
6 |
7 | $evm.log("info", "#{@method} - EVM Automate Method Started")
8 |
9 | require 'rest-client'
10 | require 'json'
11 | require 'openssl'
12 | require 'base64'
13 |
14 | foreman_host = $evm.object['foreman_host']
15 | foreman_user = $evm.object['foreman_user']
16 | foreman_password = $evm.object.decrypt('foreman_password')
17 | hostgroup_name = $evm.object['hostgroup_name']
18 | organization_name = $evm.object['organization_name']
19 | location_name = $evm.object['location_name']
20 |
21 | vm = $evm.root['vm']
22 | vmname=vm.hostnames[0]
23 | $evm.log("info", "Deleting VM #{vm.name} with Hostname #{vmname} from Foreman.")
24 |
25 | if vm.platform != "linux" then
26 | $evm.log("info","This is not a Linux VM, skipping deletion of foreman records")
27 | exit MIQ_OK
28 | end
29 |
30 | @uri_base = "https://#{foreman_host}/api/v2/hosts"
31 | @headers = {
32 | :content_type => 'application/json',
33 | :accept => 'application/json;version=2',
34 | :authorization => "Basic #{Base64.strict_encode64("#{foreman_user}:#{foreman_password}")}"
35 | }
36 |
37 | uri = "#{@uri_base}/#{vmname}"
38 | $evm.log("info", "uri => #{uri}")
39 |
40 | request = RestClient::Request.new(
41 | method: :delete,
42 | url: uri,
43 | headers: @headers,
44 | verify_ssl: OpenSSL::SSL::VERIFY_NONE
45 | )
46 |
47 | rest_result = request.execute
48 | $evm.log("info", "Rest result: #{rest_result}")
49 |
50 | exit MIQ_OK
51 |
--------------------------------------------------------------------------------
/delete_from_foreman/remove_from_katello.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Automate Method
3 | #
4 |
5 | begin
6 | @method = 'remove_foreman'
7 | $evm.log("info", "#{@method} - EVM Automate Method Started")
8 |
9 | require 'rest-client'
10 | require 'json'
11 |
12 | def get_json(location)
13 | $evm.log("info", "Execute Query #{location} as user #{@foreman_user} with password #{@foreman_password}")
14 |
15 | response = RestClient::Request.new(
16 | :method => :get,
17 | :url => location,
18 | :verify_ssl => false,
19 | :user => @foreman_user,
20 | :password => @foreman_password,
21 | :headers => { :accept => :json,
22 | :content_type => :json }
23 | ).execute
24 |
25 | results = JSON.parse(response.to_str)
26 | end
27 |
28 | def put_json(location, json_data)
29 | response = RestClient::Request.new(
30 | :method => :put,
31 | :url => location,
32 | :verify_ssl => false,
33 | :user => @foreman_user,
34 | :password => @foreman_password,
35 | :headers => { :accept => :json,
36 | :content_type => :json},
37 | :payload => json_data
38 | ).execute
39 | results = JSON.parse(response.to_str)
40 | end
41 |
42 | # Dump all of root's attributes to the log
43 | $evm.root.attributes.sort.each { |k, v| $evm.log("info", "#{@method} Root:<$evm.root> Attribute - #{k}: #{v}")}
44 |
45 | vm=$evm.root["vm"]
46 | if not vm.hostnames[0].nil?
47 | host=vm.hostnames[0]
48 | $evm.log("info", "Found FQDN #{host} for this VM")
49 | else
50 | host="#{vm.name}.example.com"
51 | $evm.log("info", "Found no FQDN for this VM, will try #{host} instead")
52 | end
53 |
54 | @foreman_host = $evm.object['foreman_host']
55 | @foreman_user = $evm.object['foreman_user']
56 | @foreman_password = $evm.object.decrypt('foreman_password')
57 |
58 | url = "https://#{@foreman_host}/api/v2/"
59 | katello_url = "https://#{@foreman_host}/katello/api/v2/"
60 |
61 | systems = get_json(katello_url+"systems")
62 | uuid = {}
63 | hostExists = false
64 | systems['results'].each do |system|
65 | if system['name'].include? host
66 | $evm.log("Host ID #{system['id']}")
67 | $evm.log("Host UUID #{system['uuid']}")
68 | uuid = system['uuid'].to_s
69 | hostExists = true
70 | break
71 | end
72 | end
73 |
74 | if !hostExists
75 | $evm.log("info", "Host #{host} not found on Satellite")
76 | exit MIQ_OK
77 | end
78 |
79 | uri=katello_url+"systems/"+uuid+"/"
80 |
81 | request = RestClient::Request.new(
82 | method: :delete,
83 | url: uri,
84 | headers: @headers,
85 | verify_ssl: OpenSSL::SSL::VERIFY_NONE
86 | )
87 |
88 | $evm.log("info","Calling DELETE URL #{uri}")
89 | result=request.execute
90 | $evm.log("info", "Result: #{result}")
91 |
92 | #
93 | # Exit method
94 | #
95 | $evm.log("info", "#{@method} - EVM Automate Method Ended")
96 | exit MIQ_OK
97 |
98 | #
99 | # Set Ruby rescue behavior
100 | #
101 | rescue => err
102 | $evm.log("error", "#{@method} - [#{err}]\n#{err.backtrace.join("\n")}")
103 | exit MIQ_ABORT
104 | end
105 |
106 | exit()
107 |
--------------------------------------------------------------------------------
/install_all_updates/README.md:
--------------------------------------------------------------------------------
1 | more details on how to use this script can be found here: http://www.jung-christian.de/2015/09/install-all-available-updates-via-satellite-6/
2 |
--------------------------------------------------------------------------------
/install_all_updates/dialog_export_20150911_114244.yml:
--------------------------------------------------------------------------------
1 | ---
2 | - description: confirmation dialog
3 | buttons: submit,cancel
4 | label: confirmation
5 | dialog_tabs:
6 | - description: General
7 | display: edit
8 | label: General
9 | display_method:
10 | display_method_options:
11 | position: 0
12 | dialog_groups:
13 | - description: General
14 | display: edit
15 | label: General
16 | display_method:
17 | display_method_options:
18 | position: 0
19 | dialog_fields:
20 | - name: confirm
21 | description: Select Yes to continue
22 | type: DialogFieldCheckBox
23 | data_type:
24 | notes:
25 | notes_display:
26 | display: edit
27 | display_method:
28 | display_method_options: {}
29 | required: true
30 | required_method:
31 | required_method_options: {}
32 | default_value: f
33 | values:
34 | values_method:
35 | values_method_options: {}
36 | options: {}
37 | label: Are you sure?
38 | position: 0
39 | validator_type:
40 | validator_rule:
41 | reconfigurable:
42 | dynamic: false
43 | show_refresh_button:
44 | load_values_on_init:
45 | read_only: false
46 | auto_refresh:
47 | trigger_auto_refresh:
48 | resource_action:
49 | action:
50 | resource_type: DialogField
51 | ae_namespace:
52 | ae_class:
53 | ae_instance:
54 | ae_message:
55 | ae_attributes: {}
56 |
--------------------------------------------------------------------------------
/install_all_updates/install_all_updates.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Automate Method
3 | #
4 |
5 | begin
6 | @method = 'install_all_updates'
7 | $evm.log("info", "#{@method} - EVM Automate Method Started")
8 |
9 | require 'rest-client'
10 | require 'json'
11 |
12 | # Dump all of root's attributes to the log
13 | $evm.root.attributes.sort.each { |k, v| $evm.log("info", "#{@method} Root:<$evm.root> Attribute - #{k}: #{v}")}
14 |
15 | vm=$evm.root["vm"]
16 | if not vm.hostnames[0].nil?
17 | host=vm.hostnames[0]
18 | $evm.log("info", "Found FQDN #{host} for this VM")
19 | else
20 | host="#{vm.name}.example.com"
21 | $evm.log("info", "Found no FQDN for this VM, will try #{host} instead")
22 | end
23 |
24 | @foreman_host = $evm.object['foreman_host']
25 | @foreman_user = $evm.object['foreman_user']
26 | @foreman_password = $evm.object.decrypt('foreman_password')
27 |
28 | def get_json(location)
29 | response = RestClient::Request.new(
30 | :method => :get,
31 | :url => location,
32 | :verify_ssl => false,
33 | :user => @foreman_user,
34 | :password => @foreman_password,
35 | :headers => { :accept => :json,
36 | :content_type => :json }
37 | ).execute
38 |
39 | results = JSON.parse(response.to_str)
40 | end
41 |
42 | def put_json(location, json_data)
43 | response = RestClient::Request.new(
44 | :method => :put,
45 | :url => location,
46 | :verify_ssl => false,
47 | :user => @foreman_user,
48 | :password => @foreman_password,
49 | :headers => { :accept => :json,
50 | :content_type => :json},
51 | :payload => json_data
52 | ).execute
53 | results = JSON.parse(response.to_str)
54 | end
55 |
56 | url = "https://#{@foreman_host}/api/v2/"
57 | katello_url = "https://#{@foreman_host}/katello/api/v2/"
58 |
59 | systems = get_json(katello_url+"systems")
60 | uuid = {}
61 | hostExists = false
62 | systems['results'].each do |system|
63 | $evm.log("info","Current Name: #{system["name"]} comparing to #{host}")
64 | if system['name'].include? host
65 | $evm.log("info","Host ID #{system['id']}")
66 | $evm.log("info","Host UUID #{system['uuid']}")
67 | uuid = system['uuid'].to_s
68 | hostExists = true
69 | break
70 | end
71 | end
72 |
73 | if !hostExists
74 | $evm.log("info", "Host #{host} not found on Satellite")
75 | exit MIQ_OK
76 | end
77 |
78 | erratas = get_json(katello_url+"systems/"+uuid+"/errata")
79 | errata_list = Array.new
80 | erratas['results'].each do |errata|
81 | errata_id = errata['errata_id']
82 | $evm.log("info", "Errata id[#{errata["errata_id"]}] title[#{errata["title"]} severity[#{errata["severity"]} found")
83 | errata_list.push errata_id
84 | end
85 |
86 | if erratas['results'].nil? || erratas['results'].empty?
87 | $evm.log("info","No erratas found for host #{host}")
88 | end
89 |
90 | errata_result = put_json(katello_url+"systems/"+uuid+"/errata/apply", JSON.generate({"errata_ids"=>errata_list}))
91 |
92 | #
93 | # Exit method
94 | #
95 | $evm.log("info", "#{@method} - EVM Automate Method Ended")
96 | exit MIQ_OK
97 |
98 | #
99 | # Set Ruby rescue behavior
100 | #
101 | rescue => err
102 | $evm.log("error", "#{@method} - [#{err}]\n#{err.backtrace.join("\n")}")
103 | exit MIQ_ABORT
104 | end
105 |
106 | exit()
107 |
--------------------------------------------------------------------------------
/register_foreman/CatalogItemInitialization.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Description: Tag service and set provison options based on service dialog entries.
3 | # 1. Look for all Service Dialog Options in the service_template_provision_task.dialog_options
4 | # (i.e. Dialog options that came from either a Catalog Bundle Service or a Service Dialog)
5 | # 2. Service dialog option keys that match the regular expression /^tag_\d*_(.*)/i
6 | # (I.e. __variable, tag_0_function, tag_1_environment) will be used to
7 | # tag the destination Catalog Item Service and any subordinate miq_provision tasks
8 | # 3. The remaining Service Dialog Option keys are simply passed into the subordinate
9 | # miq_provision object. I.e. option_0_vm_memory => 2048
10 | #
11 | # Inputs: $evm.root['service_template_provision_task'].dialog_options
12 | #
13 |
14 | # Look for service dialog variables in the dialog options hash that start with "tag_[0-9]",
15 | def get_tags_hash(dialog_options)
16 | # Setup regular expression for service dialog tags
17 | tags_regex = /^dialog_tag_\d*_(.*)/
18 |
19 | tags_hash = {}
20 |
21 | # Loop through all of the tags and build an options_hash from them
22 | dialog_options.each do |k, v|
23 | if tags_regex =~ k
24 | # Convert key to symbol
25 | tag_category = Regexp.last_match[1].to_sym
26 | tag_value = v.downcase
27 |
28 | unless tag_value.blank?
29 | $evm.log("info", "Adding category:<#{tag_category.inspect}> tag:<#{tag_value.inspect}> to tags_hash")
30 | tags_hash[tag_category] = tag_value
31 | end
32 | end
33 | end
34 | $evm.log("info", "Inspecting tags_hash:<#{tags_hash.inspect}>")
35 | tags_hash
36 | end
37 |
38 | # Look for service dialog variables in the dialog options hash that start with "option_[0-9]",
39 | def get_options_hash(dialog_options)
40 | # Setup regular expression for service dialog tags
41 | options_regex = /^dialog_option_\d*_(.*)/
42 | options_hash = {}
43 |
44 | # Loop through all of the options and build an options_hash from them
45 | dialog_options.each do |k, v|
46 | if options_regex =~ k
47 | option_key = Regexp.last_match[1].to_sym
48 | option_value = v
49 |
50 | unless option_value.blank?
51 | $evm.log("info", "Adding option_key:<#{option_key.inspect}> option_value:<#{option_value.inspect}> to options_hash")
52 | options_hash[option_key] = option_value
53 | end
54 | else
55 | unless v.nil?
56 | $evm.log("info", "Adding option:<#{k.to_sym.inspect}> value:<#{v.inspect}> to options_hash")
57 | options_hash[k.to_sym] = v
58 | end
59 | end
60 | end
61 | $evm.log("info", "Inspecting options_hash:<#{options_hash.inspect}>")
62 | options_hash
63 | end
64 |
65 | # Look in tags_hash for tags and tag the service
66 | def tag_service(service, tags_hash)
67 | # Look for tags with a sequence_id of 0 to tag the destination Service
68 | unless tags_hash.nil?
69 | tags_hash.each do |k, v|
70 | $evm.log("info", "Adding Tag:<#{k.inspect}/#{v.inspect}> to Service:<#{service.name}>")
71 | service.tag_assign("#{k}/#{v}")
72 | end
73 | end
74 | end
75 |
76 | # Get the task object from root
77 | service_template_provision_task = $evm.root['service_template_provision_task']
78 |
79 | # Get destination service object
80 | service = service_template_provision_task.destination
81 | $evm.log("info", "Detected Service:<#{service.name}> Id:<#{service.id}>")
82 |
83 | # Get dialog options from options hash
84 | # {:dialog=>{"option_0_myvar"=>"myprefix", "option_1_vservice_workers"=>"2", "tag_0_environment"=>"test", "tag_0_location"=>"paris",
85 | # "option_2_vm_memory"=>"2048", "option_0_vlan"=>"Internal", "option_1_cores_per_socket"=>"1"}}
86 | dialog_options = service_template_provision_task.dialog_options
87 | $evm.log("info", "Inspecting Dialog Options:<#{dialog_options.inspect}>")
88 |
89 | # Get tags_hash
90 | tags_hash = get_tags_hash(dialog_options)
91 |
92 | # Tag Service
93 | tag_service(service, tags_hash)
94 |
95 | # Get options_hash
96 | options_hash = get_options_hash(dialog_options)
97 |
98 | # Process Child Tasks
99 | service_template_provision_task.miq_request_tasks.each do |t|
100 |
101 | # Process grandchildren service options
102 | unless t.miq_request_tasks.nil?
103 | grandchild_tasks = t.miq_request_tasks
104 | grandchild_tasks.each do |gc|
105 | $evm.log("info", "Detected Grandchild Task ID:<#{gc.id}> Description:<#{gc.description}> source type:<#{gc.source_type}>")
106 |
107 | # If child task is provisioning then apply tags and options
108 | if gc.source_type == "template"
109 | unless tags_hash.nil?
110 | tags_hash.each do |k, v|
111 | $evm.log("info", "Adding Tag:<#{k.inspect}/#{v.inspect}> to Provisioning ID:<#{gc.id}>")
112 | gc.add_tag(k, v)
113 | end
114 | end
115 | unless options_hash.nil?
116 | options_hash.each do |k, v|
117 | $evm.log("info", "Adding Option:<{#{k.inspect} => #{v.inspect}}> to Provisioning ID:<#{gc.id}>")
118 | gc.set_option(k, v)
119 | end
120 | end
121 | gc.set_option(:vm_auto_start,[false,0])
122 | else
123 | $evm.log("info", "Invalid Source Type:<#{gc.source_type}>. Skipping task ID:<#{gc.id}>")
124 | end # if gc.source_type
125 | end # grandchild_tasks.each do
126 | end # unless t.miq_request_tasks.nil?
127 | end # service_template_provision_task.miq_request_tasks.each do
128 |
129 |
--------------------------------------------------------------------------------
/register_foreman/CustomizeRequest.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Description: This method is used to Customize the RHEV, RHEV PXE, and RHEV ISO Provisioning Request
3 | #
4 | @method = 'CustomizeRequest'
5 | $evm.log("info", "#{@method} - EVM Automate Method Started")
6 |
7 | # Get provisioning object
8 | prov = $evm.root["miq_provision"]
9 |
10 | $evm.log("info", "Provisioning ID:<#{prov.id}> Provision Request ID:<#{prov.miq_provision_request.id}> Provision Type: <#{prov.provision_type}>")
11 |
12 | # Dump all of root's attributes to the log
13 | $evm.root.attributes.sort.each { |k, v| $evm.log("info", "#{@method} Root:<$evm.root> Attribute - #{k}: #{v}")}
14 |
15 | fqdn=prov.get_option(:dialog_fqdn)
16 | if fqdn.nil? or fqdn.blank?
17 | $evm.log("info", "No FQDN in dialog specified, keeping default auto name")
18 | else
19 | $evm.log("info", "FQDN from Dialog: #{fqdn}")
20 | shortname=fqdn.split('.')[0]
21 | $evm.log("info", "Using short name #{shortname}>")
22 | prov.set_option(:vm_target_name,shortname)
23 | prov.set_option(:vm_target_hostname,fqdn)
24 | end
25 |
26 |
--------------------------------------------------------------------------------
/register_foreman/README.md:
--------------------------------------------------------------------------------
1 | These scripts can be used to register a new system in Foreman or Red Hat Satellite during provisioning.
2 |
3 | Details on how to use those scripts can be found here:
4 | http://www.jung-christian.de/2015/04/how-to-provision-vms-with-foreman-and-manageiq/
5 |
6 |
--------------------------------------------------------------------------------
/register_foreman/register_foreman-class.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cbolz/ManageIQ/614db37758bd3f6e9f9bd4c8407af4dd7aa4c1dd/register_foreman/register_foreman-class.png
--------------------------------------------------------------------------------
/register_foreman/register_foreman.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Description: Create configured host record in Foreman
3 | #
4 |
5 | @method = 'register_foreman'
6 |
7 | $evm.log("info", "#{@method} - EVM Automate Method Started")
8 |
9 | # Dump all of root's attributes to the log
10 | $evm.root.attributes.sort.each { |k, v| $evm.log("info", "#{@method} Root:<$evm.root> Attribute - #{k}: #{v}")}
11 |
12 | require 'rest-client'
13 | require 'json'
14 | require 'openssl'
15 | require 'base64'
16 |
17 | foreman_host = $evm.object['foreman_host']
18 | foreman_user = $evm.object['foreman_user']
19 | foreman_password = $evm.object.decrypt('foreman_password')
20 | hostgroup_name = $evm.object['hostgroup_name']
21 | organization_name = $evm.object['organization_name']
22 | location_name = $evm.object['location_name']
23 |
24 | prov = $evm.root['miq_provision']
25 | vm = prov.vm
26 |
27 | @uri_base = "https://#{foreman_host}/api/v2"
28 | @headers = {
29 | :content_type => 'application/json',
30 | :accept => 'application/json;version=2',
31 | :authorization => "Basic #{Base64.strict_encode64("#{foreman_user}:#{foreman_password}")}"
32 | }
33 |
34 | def query_id (queryuri,queryfield,querycontent)
35 | # queryuri: path name related to @uri_base, where to search (hostgroups, locations, ...)
36 | # queryfield: which field (as in database row) should be searched
37 | # querycontent: what the queryfield has to match (exact match)
38 |
39 | # Put the search URL together
40 | url = URI.escape("#{@uri_base}/#{queryuri}?search=#{queryfield}=\"#{querycontent}\"")
41 |
42 | $evm.log("info", "url => #{url}")
43 |
44 | request = RestClient::Request.new(
45 | method: :get,
46 | url: url,
47 | headers: @headers,
48 | verify_ssl: OpenSSL::SSL::VERIFY_NONE
49 | )
50 |
51 | rest_result = request.execute
52 | json_parse = JSON.parse(rest_result)
53 |
54 | # The subtotal value is the number of matching results.
55 | # If it is higher than one, the query got no unique result!
56 | subtotal = json_parse['subtotal'].to_i
57 |
58 | if subtotal == 0
59 | $evm.log("info", "query failed, no result #{url}")
60 | return -1
61 | elsif subtotal == 1
62 | id = json_parse['results'][0]['id'].to_s
63 | return id
64 | elsif subtotal > 1
65 | $evm.log("info", "query failed, more than one result #{url}")
66 | return -1
67 | end
68 |
69 | $evm.log("info", "query failed, unknown condition #{url}")
70 | return -1
71 | end
72 |
73 | # Get the hostgroup id using the supplied name
74 | $evm.log("info", 'Getting hostgroup id from Foreman')
75 | hostgroup_id=query_id("hostgroups","name",hostgroup_name)
76 | $evm.log("info", "hostgroup_id: #{hostgroup_id}")
77 | if hostgroup_id == -1
78 | $evm.log("info", "Cannot continue without hostgroup_id")
79 | exit MIQ_ABORT
80 | end
81 |
82 | # Get the location id using the supplied name
83 | $evm.log("info", 'Getting location id from Foreman')
84 | location_id=query_id("locations","name",location_name)
85 | $evm.log("info", "location_id: #{location_id}")
86 | if location_id == -1
87 | $evm.log("info", "Cannot continue without location_id")
88 | exit MIQ_ABORT
89 | end
90 |
91 | # Get the organization id using the supplied name
92 | $evm.log("info", 'Getting organization id from Foreman')
93 | organization_id=query_id("organizations","name",organization_name)
94 | $evm.log("info", "organization_id: #{organization_id}")
95 | if organization_id == -1
96 | $evm.log("info", "Cannot continue without organization_id")
97 | exit MIQ_ABORT
98 | end
99 |
100 | # Create the host via Foreman
101 | uri = "#{@uri_base}"
102 | # Now create the host in Foreman
103 | $evm.log("info", 'Creating host in Foreman')
104 |
105 | hostinfo = {
106 | :name => vm.name,
107 | :mac => vm.mac_addresses[0],
108 | :hostgroup_id => hostgroup_id,
109 | :location_id => location_id,
110 | :organization_id => organization_id,
111 | :build => 'true'
112 | }
113 | $evm.log("info", "Sending Host Details: #{hostinfo}")
114 |
115 | uri = "#{@uri_base}/hosts"
116 | request = RestClient::Request.new(
117 | method: :post,
118 | url: uri,
119 | headers: @headers,
120 | verify_ssl: OpenSSL::SSL::VERIFY_NONE,
121 | payload: { host: hostinfo }.to_json
122 | )
123 |
124 | rest_result = request.execute
125 | $evm.log("info", "return code => <#{rest_result.code}>")
126 |
127 | json_parse = JSON.parse(rest_result)
128 | hostid = json_parse['id'].to_s
129 |
130 | $evm.log("info", "Storing Foreman host ID of new VM: #{hostid}")
131 | prov.set_option(:hostid,hostid)
132 |
133 | $evm.log("info", "Powering on VM")
134 | vm.start
135 |
136 | exit MIQ_OK
137 |
138 |
--------------------------------------------------------------------------------
/register_foreman/vmprovision_vm-class.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cbolz/ManageIQ/614db37758bd3f6e9f9bd4c8407af4dd7aa4c1dd/register_foreman/vmprovision_vm-class.png
--------------------------------------------------------------------------------
/rhev/README.md:
--------------------------------------------------------------------------------
1 | To install the methods into your appliance, download the cjung directory tree, zip it and import it via "Automate, Import/Export"
2 |
3 | dialog_export*.yml contains example dialogs you can use to design the custom buttons.
4 |
5 | More information can be found on http://www.jung-christian.de/2015/06/manage-vm-snapshots-in-rhevovirt-with-manageiq/
6 |
7 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: RHEV
7 | description: RHEV
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/__class__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: class
3 | version: 1.0
4 | object:
5 | attributes:
6 | description: snapshots
7 | display_name: snapshots
8 | name: snapshots
9 | type:
10 | inherits:
11 | visibility:
12 | owner:
13 | schema:
14 | - field:
15 | aetype: method
16 | name: execute
17 | display_name:
18 | datatype: string
19 | priority: 1
20 | owner:
21 | default_value:
22 | substitute: true
23 | message: create
24 | visibility:
25 | collect:
26 | scope:
27 | description:
28 | condition:
29 | on_entry:
30 | on_exit:
31 | on_error:
32 | max_retries:
33 | max_time:
34 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/__methods__/create_snapshot.rb:
--------------------------------------------------------------------------------
1 | #
2 | # create_snapshot.rb
3 | # Description: create a snapshot of the selected VM
4 | #
5 | require 'rest-client'
6 | require 'json'
7 | require 'openssl'
8 |
9 | def call_rhevm(ext_mgt_system, uri, type=:get, payload=nil)
10 | params = {
11 | :method => type,
12 | :url => "https://#{ext_mgt_system[:hostname]}#{uri}",
13 | :user => ext_mgt_system.authentication_userid,
14 | :password => ext_mgt_system.authentication_password,
15 | :headers => { :accept => :json, :content_type => :json },
16 | :verify_ssl => OpenSSL::SSL::VERIFY_NONE
17 | }
18 | params[:payload] = JSON.generate(payload) if payload
19 | return JSON.parse(RestClient::Request.new(params).execute)
20 | end
21 |
22 | $evm.log("info", "Begin Automate Method")
23 |
24 | ext_mgt_system = $evm.root['vm'].ext_management_system.id
25 |
26 | $evm.log("info", "Got ext_management_system #{ext_mgt_system.name}")
27 |
28 | vm=$evm.root["vm"]
29 | vmuuid=vm["uid_ems"]
30 | $evm.log("info", "RHEV UUID: #{vmuuid}")
31 |
32 | payload = {
33 | :description => $evm.root["dialog_snapshot_name"]
34 | }
35 |
36 | $evm.log("info", "Calling /api/vms/#{vmuuid}/snapshots/ with payload #{payload}")
37 | create_snapshot = call_rhevm(ext_mgt_system, "/api/vms/#{vmuuid}/snapshots/", :post, payload)
38 |
39 | $evm.log("info", "End Automate Method")
40 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/__methods__/create_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: create_snapshot
7 | display_name: create_snapshot
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/__methods__/delete_snapshot.rb:
--------------------------------------------------------------------------------
1 | #
2 | # delete_snapshot.rb
3 | # Description: delete a snapshot of the selected VM
4 | #
5 | require 'rest-client'
6 | require 'json'
7 | require 'openssl'
8 |
9 | def call_rhevm(ext_mgt_system, uri, type=:get, payload=nil)
10 | params = {
11 | :method => type,
12 | :url => "https://#{ext_mgt_system[:hostname]}#{uri}",
13 | :user => ext_mgt_system.authentication_userid,
14 | :password => ext_mgt_system.authentication_password,
15 | :headers => { :accept => :json, :content_type => :json },
16 | :verify_ssl => OpenSSL::SSL::VERIFY_NONE
17 | }
18 | params[:payload] = JSON.generate(payload) if payload
19 | return JSON.parse(RestClient::Request.new(params).execute)
20 | end
21 |
22 | $evm.log("info", "Begin Automate Method")
23 |
24 | ext_mgt_system = $evm.root['vm'].ext_management_system.id
25 |
26 | $evm.log("info", "Got ext_management_system #{ext_mgt_system.name}")
27 |
28 | vm=$evm.root["vm"]
29 | vmuuid=vm["uid_ems"]
30 | $evm.log("info", "RHEV UUID: #{vmuuid}")
31 |
32 | snapshotid=$evm.root["dialog_snapshot_name"]
33 |
34 | $evm.log("info", "Calling DELETE on /api/vms/#{vmuuid}/snapshots/#{snapshotid}")
35 | create_snapshot = call_rhevm(ext_mgt_system, "/api/vms/#{vmuuid}/snapshots/#{snapshotid}", :delete)
36 |
37 | $evm.log("info", "End Automate Method")
38 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/__methods__/delete_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: delete_snapshot
7 | display_name: delete_snapshot
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/__methods__/dialog_list_snapshots.rb:
--------------------------------------------------------------------------------
1 | #
2 | # dialog_list_snapshots.rb
3 | # Description: Retrieve a list of available snapshots for the selected VM
4 | # To be used in a dynamic dropdown list
5 | #
6 | require 'rest-client'
7 | require 'json'
8 | require 'openssl'
9 |
10 | def call_rhevm(ext_mgt_system, uri, type=:get, payload=nil)
11 | params = {
12 | :method => type,
13 | :url => "https://#{ext_mgt_system[:hostname]}#{uri}",
14 | :user => ext_mgt_system.authentication_userid,
15 | :password => ext_mgt_system.authentication_password,
16 | :headers => { :accept => :json, :content_type => :json },
17 | :verify_ssl => OpenSSL::SSL::VERIFY_NONE
18 | }
19 | params[:payload] = JSON.generate(payload) if payload
20 | return JSON.parse(RestClient::Request.new(params).execute)
21 | end
22 |
23 | $evm.log("info", "Begin Automate Method")
24 |
25 | ext_mgt_system = $evm.root['vm'].ext_management_system.id
26 |
27 | $evm.log("info", "Got ext_management_system #{ext_mgt_system.name}")
28 |
29 | vm=$evm.root["vm"]
30 | vmuuid=vm["uid_ems"]
31 | $evm.log("info", "RHEV UUID: #{vmuuid}")
32 |
33 | snapshots = call_rhevm(ext_mgt_system, "/api/vms/#{vmuuid}/snapshots/", :get)
34 |
35 | dialog_field = $evm.object
36 | # sort_by: value / description / none
37 | dialog_field["sort_by"] = "description"
38 | # sort_order: ascending / descending
39 | dialog_field["sort_order"] = "ascending"
40 | # data_type: string / integer
41 | dialog_field["data_type"] = "string"
42 | # required: true / false
43 | dialog_field["required"] = "true"
44 |
45 | snapshotlist={}
46 | snapshots["snapshot"].each do |snapshot|
47 | $evm.log("info", "Current snapshot: #{snapshot["description"]}")
48 | description=snapshot["description"]
49 | id=snapshot["id"]
50 | snapshotlist[id]=description
51 | end
52 |
53 | $evm.log("info", "Liste: #{snapshotlist}")
54 |
55 | dialog_field["values"]=snapshotlist
56 |
57 | #$evm.log("info", "Response: #{import_response.inspect}")
58 | #import_job = import_response["job"]["href"]
59 |
60 | $evm.log("info", "End Automate Method")
61 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/__methods__/dialog_list_snapshots.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: dialog_list_snapshots
7 | display_name: dialog_list_snapshots
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/__methods__/revert_snapshot.rb:
--------------------------------------------------------------------------------
1 | #
2 | # revert_snapshot.rb
3 | # Description: revert to the selected snapshot
4 | #
5 | require 'rest-client'
6 | require 'json'
7 | require 'openssl'
8 |
9 | def call_rhevm(ext_mgt_system, uri, type=:get, payload=nil)
10 | params = {
11 | :method => type,
12 | :url => "https://#{ext_mgt_system[:hostname]}#{uri}",
13 | :user => ext_mgt_system.authentication_userid,
14 | :password => ext_mgt_system.authentication_password,
15 | :headers => { :accept => :xml, :content_type => :xml },
16 | :verify_ssl => OpenSSL::SSL::VERIFY_NONE
17 | }
18 | params[:payload] = payload if payload
19 | return JSON.parse(RestClient::Request.new(params).execute)
20 | end
21 |
22 | $evm.log("info", "Begin Automate Method")
23 |
24 | ext_mgt_system = $evm.root['vm'].ext_management_system.id
25 |
26 | $evm.log("info", "Got ext_management_system #{ext_mgt_system.name}")
27 |
28 | vm=$evm.root["vm"]
29 | vmuuid=vm["uid_ems"]
30 | $evm.log("info", "RHEV UUID: #{vmuuid}")
31 |
32 | snapshotid=$evm.root["dialog_snapshot_name"]
33 |
34 | $evm.log("info", "Sending POST to restore action URL /api/vms/#{vmuuid}/snapshots/#{snapshotid}/restore")
35 |
36 | payload = ""
37 |
38 | create_snapshot=call_rhevm(ext_mgt_system, "/api/vms/#{vmuuid}/snapshots/#{snapshotid}/restore", :post, payload)
39 |
40 | $evm.log("info", "End Automate Method")
41 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/__methods__/revert_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: method
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: revert_snapshot
7 | display_name: revert_snapshot
8 | description:
9 | scope: instance
10 | language: ruby
11 | location: inline
12 | inputs: []
13 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/create_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: create_snapshot
7 | name: create_snapshot
8 | inherits:
9 | description: create_snapshot
10 | fields:
11 | - execute:
12 | value: create_snapshot
13 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/delete_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: delete_snapshot
7 | name: delete_snapshot
8 | inherits:
9 | description: delete_snapshot
10 | fields:
11 | - execute:
12 | value: delete_snapshot
13 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/dialog_list_snapshots.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: dialog_list_snapshots
7 | name: dialog_list_snapshots
8 | inherits:
9 | description: dialog_list_snapshots
10 | fields:
11 | - execute:
12 | value: dialog_list_snapshots
13 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/RHEV/snapshots.class/revert_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: revert_snapshot
7 | name: revert_snapshot
8 | inherits:
9 | description: revert_snapshot
10 | fields:
11 | - execute:
12 | value: revert_snapshot
13 |
--------------------------------------------------------------------------------
/rhev/cjung/Integration/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: Integration
7 | description: Integration
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/rhev/cjung/System/Request.class/__class__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: class
3 | version: 1.0
4 | object:
5 | attributes:
6 | description: Automation Requests
7 | display_name:
8 | name: Request
9 | type:
10 | inherits:
11 | visibility:
12 | owner:
13 | schema:
14 | - field:
15 | aetype: assertion
16 | name: guard
17 | display_name:
18 | datatype:
19 | priority: 1
20 | owner:
21 | default_value:
22 | substitute: true
23 | message: create
24 | visibility:
25 | collect:
26 | scope:
27 | description:
28 | condition:
29 | on_entry:
30 | on_exit:
31 | on_error:
32 | max_retries:
33 | max_time:
34 | - field:
35 | aetype: method
36 | name: on_entry
37 | display_name:
38 | datatype:
39 | priority: 2
40 | owner:
41 | default_value:
42 | substitute: true
43 | message: create
44 | visibility:
45 | collect:
46 | scope:
47 | description:
48 | condition:
49 | on_entry:
50 | on_exit:
51 | on_error:
52 | max_retries:
53 | max_time:
54 | - field:
55 | aetype: relationship
56 | name: rel1
57 | display_name:
58 | datatype:
59 | priority: 3
60 | owner:
61 | default_value:
62 | substitute: true
63 | message: create
64 | visibility:
65 | collect:
66 | scope:
67 | description:
68 | condition:
69 | on_entry:
70 | on_exit:
71 | on_error:
72 | max_retries:
73 | max_time:
74 | - field:
75 | aetype: method
76 | name: meth1
77 | display_name:
78 | datatype:
79 | priority: 4
80 | owner:
81 | default_value:
82 | substitute: true
83 | message: create
84 | visibility:
85 | collect:
86 | scope:
87 | description:
88 | condition:
89 | on_entry:
90 | on_exit:
91 | on_error:
92 | max_retries:
93 | max_time:
94 | - field:
95 | aetype: relationship
96 | name: rel2
97 | display_name:
98 | datatype:
99 | priority: 5
100 | owner:
101 | default_value:
102 | substitute: true
103 | message: create
104 | visibility:
105 | collect:
106 | scope:
107 | description:
108 | condition:
109 | on_entry:
110 | on_exit:
111 | on_error:
112 | max_retries:
113 | max_time:
114 | - field:
115 | aetype: method
116 | name: meth2
117 | display_name:
118 | datatype:
119 | priority: 6
120 | owner:
121 | default_value:
122 | substitute: true
123 | message: create
124 | visibility:
125 | collect:
126 | scope:
127 | description:
128 | condition:
129 | on_entry:
130 | on_exit:
131 | on_error:
132 | max_retries:
133 | max_time:
134 | - field:
135 | aetype: relationship
136 | name: rel3
137 | display_name:
138 | datatype:
139 | priority: 7
140 | owner:
141 | default_value:
142 | substitute: true
143 | message: create
144 | visibility:
145 | collect:
146 | scope:
147 | description:
148 | condition:
149 | on_entry:
150 | on_exit:
151 | on_error:
152 | max_retries:
153 | max_time:
154 | - field:
155 | aetype: method
156 | name: meth3
157 | display_name:
158 | datatype:
159 | priority: 8
160 | owner:
161 | default_value:
162 | substitute: true
163 | message: create
164 | visibility:
165 | collect:
166 | scope:
167 | description:
168 | condition:
169 | on_entry:
170 | on_exit:
171 | on_error:
172 | max_retries:
173 | max_time:
174 | - field:
175 | aetype: relationship
176 | name: rel4
177 | display_name:
178 | datatype:
179 | priority: 9
180 | owner:
181 | default_value:
182 | substitute: true
183 | message: create
184 | visibility:
185 | collect:
186 | scope:
187 | description:
188 | condition:
189 | on_entry:
190 | on_exit:
191 | on_error:
192 | max_retries:
193 | max_time:
194 | - field:
195 | aetype: method
196 | name: meth4
197 | display_name:
198 | datatype:
199 | priority: 10
200 | owner:
201 | default_value:
202 | substitute: true
203 | message: create
204 | visibility:
205 | collect:
206 | scope:
207 | description:
208 | condition:
209 | on_entry:
210 | on_exit:
211 | on_error:
212 | max_retries:
213 | max_time:
214 | - field:
215 | aetype: relationship
216 | name: rel5
217 | display_name:
218 | datatype:
219 | priority: 11
220 | owner:
221 | default_value:
222 | substitute: true
223 | message: create
224 | visibility:
225 | collect:
226 | scope:
227 | description:
228 | condition:
229 | on_entry:
230 | on_exit:
231 | on_error:
232 | max_retries:
233 | max_time:
234 | - field:
235 | aetype: method
236 | name: meth5
237 | display_name:
238 | datatype:
239 | priority: 12
240 | owner:
241 | default_value:
242 | substitute: true
243 | message: create
244 | visibility:
245 | collect:
246 | scope:
247 | description:
248 | condition:
249 | on_entry:
250 | on_exit:
251 | on_error:
252 | max_retries:
253 | max_time:
254 | - field:
255 | aetype: relationship
256 | name: rel6
257 | display_name:
258 | datatype:
259 | priority: 13
260 | owner:
261 | default_value:
262 | substitute: true
263 | message: create
264 | visibility:
265 | collect:
266 | scope:
267 | description:
268 | condition:
269 | on_entry:
270 | on_exit:
271 | on_error:
272 | max_retries:
273 | max_time:
274 | - field:
275 | aetype: method
276 | name: meth6
277 | display_name:
278 | datatype:
279 | priority: 14
280 | owner:
281 | default_value:
282 | substitute: true
283 | message: create
284 | visibility:
285 | collect:
286 | scope:
287 | description:
288 | condition:
289 | on_entry:
290 | on_exit:
291 | on_error:
292 | max_retries:
293 | max_time:
294 | - field:
295 | aetype: relationship
296 | name: rel7
297 | display_name:
298 | datatype:
299 | priority: 15
300 | owner:
301 | default_value:
302 | substitute: true
303 | message: create
304 | visibility:
305 | collect:
306 | scope:
307 | description:
308 | condition:
309 | on_entry:
310 | on_exit:
311 | on_error:
312 | max_retries:
313 | max_time:
314 | - field:
315 | aetype: method
316 | name: meth7
317 | display_name:
318 | datatype:
319 | priority: 16
320 | owner:
321 | default_value:
322 | substitute: true
323 | message: create
324 | visibility:
325 | collect:
326 | scope:
327 | description:
328 | condition:
329 | on_entry:
330 | on_exit:
331 | on_error:
332 | max_retries:
333 | max_time:
334 | - field:
335 | aetype: relationship
336 | name: rel8
337 | display_name:
338 | datatype:
339 | priority: 17
340 | owner:
341 | default_value:
342 | substitute: true
343 | message: create
344 | visibility:
345 | collect:
346 | scope:
347 | description:
348 | condition:
349 | on_entry:
350 | on_exit:
351 | on_error:
352 | max_retries:
353 | max_time:
354 | - field:
355 | aetype: method
356 | name: meth8
357 | display_name:
358 | datatype:
359 | priority: 18
360 | owner:
361 | default_value:
362 | substitute: true
363 | message: create
364 | visibility:
365 | collect:
366 | scope:
367 | description:
368 | condition:
369 | on_entry:
370 | on_exit:
371 | on_error:
372 | max_retries:
373 | max_time:
374 | - field:
375 | aetype: relationship
376 | name: rel9
377 | display_name:
378 | datatype:
379 | priority: 19
380 | owner:
381 | default_value:
382 | substitute: true
383 | message: create
384 | visibility:
385 | collect:
386 | scope:
387 | description:
388 | condition:
389 | on_entry:
390 | on_exit:
391 | on_error:
392 | max_retries:
393 | max_time:
394 | - field:
395 | aetype: method
396 | name: on_exit
397 | display_name:
398 | datatype:
399 | priority: 20
400 | owner:
401 | default_value:
402 | substitute: true
403 | message: create
404 | visibility:
405 | collect:
406 | scope:
407 | description:
408 | condition:
409 | on_entry:
410 | on_exit:
411 | on_error:
412 | max_retries:
413 | max_time:
414 |
--------------------------------------------------------------------------------
/rhev/cjung/System/Request.class/create_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: create_snapshot
7 | name: create_snapshot
8 | inherits:
9 | description: create_snapshot
10 | fields:
11 | - rel3:
12 | value: "/Integration/RHEV/snapshots/create_snapshot"
13 |
--------------------------------------------------------------------------------
/rhev/cjung/System/Request.class/delete_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: delete_snapshot
7 | name: delete_snapshot
8 | inherits:
9 | description: delete_snapshot
10 | fields:
11 | - rel3:
12 | value: "/Integration/RHEV/snapshots/delete_snapshot"
13 |
--------------------------------------------------------------------------------
/rhev/cjung/System/Request.class/revert_snapshot.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: instance
3 | version: 1.0
4 | object:
5 | attributes:
6 | display_name: revert_snapshot
7 | name: revert_snapshot
8 | inherits:
9 | description: revert_snapshot
10 | fields:
11 | - rel3:
12 | value: "/Integration/RHEV/snapshots/revert_snapshot"
13 |
--------------------------------------------------------------------------------
/rhev/cjung/System/__namespace__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: namespace
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: System
7 | description:
8 | display_name:
9 | system:
10 | priority:
11 | enabled:
12 |
--------------------------------------------------------------------------------
/rhev/cjung/__domain__.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | object_type: domain
3 | version: 1.0
4 | object:
5 | attributes:
6 | name: cjung
7 | description: cjung
8 | display_name:
9 | system: false
10 | priority: 2
11 | enabled: true
12 |
--------------------------------------------------------------------------------
/rhev/dialog_export_20150617_082602.yml:
--------------------------------------------------------------------------------
1 | ---
2 | - description: delete_snapshot
3 | buttons: submit,cancel
4 | label: delete_snapshot
5 | dialog_tabs:
6 | - description: General
7 | display: edit
8 | label: General
9 | display_method:
10 | display_method_options:
11 | position: 0
12 | dialog_groups:
13 | - description: General
14 | display: edit
15 | label: General
16 | display_method:
17 | display_method_options:
18 | position: 0
19 | dialog_fields:
20 | - name: snapshot_name
21 | description: select snapshot for deletion
22 | type: DialogFieldDropDownList
23 | data_type:
24 | notes:
25 | notes_display:
26 | display: edit
27 | display_method:
28 | display_method_options: {}
29 | required: false
30 | required_method:
31 | required_method_options: {}
32 | default_value:
33 | values: []
34 | values_method:
35 | values_method_options: {}
36 | options: {}
37 | label: Select Snapshot
38 | position: 0
39 | validator_type:
40 | validator_rule:
41 | reconfigurable:
42 | dynamic: true
43 | show_refresh_button: true
44 | load_values_on_init: true
45 | read_only: false
46 | auto_refresh:
47 | trigger_auto_refresh:
48 | resource_action:
49 | action:
50 | resource_type: DialogField
51 | ae_namespace: Integration/RHEV
52 | ae_class: snapshots
53 | ae_instance: dialog_list_snapshots
54 | ae_message:
55 | ae_attributes: {}
56 | - description: revert_snapshot
57 | buttons: submit,cancel
58 | label: revert_snapshot
59 | dialog_tabs:
60 | - description: General
61 | display: edit
62 | label: General
63 | display_method:
64 | display_method_options:
65 | position: 0
66 | dialog_groups:
67 | - description: General
68 | display: edit
69 | label: General
70 | display_method:
71 | display_method_options:
72 | position: 0
73 | dialog_fields:
74 | - name: snapshot_name
75 | description: select snapshot to revert to
76 | type: DialogFieldDropDownList
77 | data_type:
78 | notes:
79 | notes_display:
80 | display: edit
81 | display_method:
82 | display_method_options: {}
83 | required: false
84 | required_method:
85 | required_method_options: {}
86 | default_value:
87 | values: []
88 | values_method:
89 | values_method_options: {}
90 | options: {}
91 | label: Select snapshot
92 | position: 0
93 | validator_type:
94 | validator_rule:
95 | reconfigurable:
96 | dynamic: true
97 | show_refresh_button: true
98 | load_values_on_init: true
99 | read_only: false
100 | auto_refresh:
101 | trigger_auto_refresh:
102 | resource_action:
103 | action:
104 | resource_type: DialogField
105 | ae_namespace: Integration/RHEV
106 | ae_class: snapshots
107 | ae_instance: dialog_list_snapshots
108 | ae_message:
109 | ae_attributes: {}
110 | - description: create_snapshot
111 | buttons: submit,cancel
112 | label: create_snapshot
113 | dialog_tabs:
114 | - description: General
115 | display: edit
116 | label: General
117 | display_method:
118 | display_method_options:
119 | position: 0
120 | dialog_groups:
121 | - description: General
122 | display: edit
123 | label: General
124 | display_method:
125 | display_method_options:
126 | position: 0
127 | dialog_fields:
128 | - name: snapshot_name
129 | description: specifiy description for snapshot
130 | type: DialogFieldTextBox
131 | data_type:
132 | notes:
133 | notes_display:
134 | display: edit
135 | display_method:
136 | display_method_options: {}
137 | required: true
138 | required_method:
139 | required_method_options: {}
140 | default_value: ''
141 | values:
142 | values_method:
143 | values_method_options: {}
144 | options:
145 | :protected: false
146 | label: Snapshot Description
147 | position: 0
148 | validator_type:
149 | validator_rule:
150 | reconfigurable:
151 | dynamic: false
152 | show_refresh_button:
153 | load_values_on_init:
154 | read_only: false
155 | auto_refresh:
156 | trigger_auto_refresh:
157 | resource_action:
158 | action:
159 | resource_type: DialogField
160 | ae_namespace:
161 | ae_class:
162 | ae_instance:
163 | ae_message:
164 | ae_attributes: {}
165 |
--------------------------------------------------------------------------------
/service-dialogs/dialog-hot-add-disk.yml:
--------------------------------------------------------------------------------
1 | ---
2 | - description: Hot add Disk
3 | buttons: submit,cancel
4 | label: Hot add Disk
5 | dialog_tabs:
6 | - description: General
7 | display: edit
8 | label: General
9 | display_method:
10 | display_method_options:
11 | position: 0
12 | dialog_groups:
13 | - description: General
14 | display: edit
15 | label: General
16 | display_method:
17 | display_method_options:
18 | position: 0
19 | dialog_fields:
20 | - name: size
21 | description: Select disk size in GB
22 | type: DialogFieldDropDownList
23 | data_type: integer
24 | notes:
25 | notes_display:
26 | display: edit
27 | display_method:
28 | display_method_options: {}
29 | required: true
30 | required_method:
31 | required_method_options: {}
32 | default_value: '10'
33 | values:
34 | - - '10'
35 | - 10 GB
36 | - - '50'
37 | - 50 GB
38 | - - '100'
39 | - 100 GB
40 | values_method:
41 | values_method_options: {}
42 | options:
43 | :sort_by: :value
44 | :sort_order: :ascending
45 | label: Disk Size
46 | position: 0
47 | validator_type:
48 | validator_rule:
49 | reconfigurable:
50 | dynamic: false
51 | show_refresh_button:
52 | load_values_on_init:
53 | read_only: false
54 | auto_refresh:
55 | trigger_auto_refresh:
56 | resource_action:
57 | action:
58 | resource_type: DialogField
59 | ae_namespace:
60 | ae_class:
61 | ae_instance:
62 | ae_message:
63 | ae_attributes: {}
64 | - name: datastore
65 | description: Select the datastore to use
66 | type: DialogFieldDropDownList
67 | data_type:
68 | notes:
69 | notes_display:
70 | display: edit
71 | display_method:
72 | display_method_options: {}
73 | required: false
74 | required_method:
75 | required_method_options: {}
76 | default_value:
77 | values:
78 | - -
79 | - "