Commit cb60db51 authored by Spiros Koulouzis's avatar Spiros Koulouzis

changed permissions to keys for ansible deployer

parent 765c98cb
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<h1 class="page-header">Files and Libraries</h1> <h1 class="page-header">Files and Libraries</h1>
<h3 id="artifact_gwt_json_overlay">GWT JSON Overlay</h3> <h3 id="artifact_gwt_json_overlay">GWT JSON Overlay</h3>
<p class="lead">Created April 12, 2017</p> <p class="lead">Created April 20, 2017</p>
<p> <p> <p> <p>
The <a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> JSON Overlay library provides the JSON Overlays that The <a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> JSON Overlay library provides the JSON Overlays that
can be used to access the Web service API for this application. can be used to access the Web service API for this application.
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
</tbody> </tbody>
</table> </table>
<h3 id="artifact_java_json_client_library">Java JSON Client Library</h3> <h3 id="artifact_java_json_client_library">Java JSON Client Library</h3>
<p class="lead">Created April 12, 2017</p> <p class="lead">Created April 20, 2017</p>
<p><p> <p><p>
The Java client-side library is used to provide the set of Java objects that can be serialized The Java client-side library is used to provide the set of Java objects that can be serialized
to/from JSON using <a href="http://jackson.codehaus.org/">Jackson</a>. This is useful for accessing the to/from JSON using <a href="http://jackson.codehaus.org/">Jackson</a>. This is useful for accessing the
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
</tbody> </tbody>
</table> </table>
<h3 id="artifact_java_xml_client_library">Java XML Client Library</h3> <h3 id="artifact_java_xml_client_library">Java XML Client Library</h3>
<p class="lead">Created April 12, 2017</p> <p class="lead">Created April 20, 2017</p>
<p><p> <p><p>
The Java client-side library is used to access the Web service API for this application using Java. The Java client-side library is used to access the Web service API for this application using Java.
</p> </p>
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
</tbody> </tbody>
</table> </table>
<h3 id="artifact_js_client_library">JavaScript Client Library</h3> <h3 id="artifact_js_client_library">JavaScript Client Library</h3>
<p class="lead">Created April 12, 2017</p> <p class="lead">Created April 20, 2017</p>
<p><p> <p><p>
The JavaScript client-side library defines classes that can be (de)serialized to/from JSON. The JavaScript client-side library defines classes that can be (de)serialized to/from JSON.
This is useful for accessing the resources that are published by this application, but only This is useful for accessing the resources that are published by this application, but only
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
</tbody> </tbody>
</table> </table>
<h3 id="artifact_php_json_client_library">PHP JSON Client Library</h3> <h3 id="artifact_php_json_client_library">PHP JSON Client Library</h3>
<p class="lead">Created April 12, 2017</p> <p class="lead">Created April 20, 2017</p>
<p><p> <p><p>
The PHP JSON client-side library defines the PHP classes that can be (de)serialized to/from JSON. The PHP JSON client-side library defines the PHP classes that can be (de)serialized to/from JSON.
This is useful for accessing the resources that are published by this application, but only This is useful for accessing the resources that are published by this application, but only
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
</tbody> </tbody>
</table> </table>
<h3 id="artifact_php_xml_client_library">PHP XML Client Library</h3> <h3 id="artifact_php_xml_client_library">PHP XML Client Library</h3>
<p class="lead">Created April 12, 2017</p> <p class="lead">Created April 20, 2017</p>
<p><p> <p><p>
The PHP client-side library defines the PHP classes that can be (de)serialized to/from XML. The PHP client-side library defines the PHP classes that can be (de)serialized to/from XML.
This is useful for accessing the resources that are published by this application, but only This is useful for accessing the resources that are published by this application, but only
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</tbody> </tbody>
</table> </table>
<h3 id="artifact_ruby_json_client_library">Ruby JSON Client Library</h3> <h3 id="artifact_ruby_json_client_library">Ruby JSON Client Library</h3>
<p class="lead">Created April 12, 2017</p> <p class="lead">Created April 20, 2017</p>
<p><p> <p><p>
The Ruby JSON client-side library defines the Ruby classes that can be (de)serialized to/from JSON. The Ruby JSON client-side library defines the Ruby classes that can be (de)serialized to/from JSON.
This is useful for accessing the REST endpoints that are published by this application, but only This is useful for accessing the REST endpoints that are published by this application, but only
......
...@@ -227,11 +227,13 @@ provisopned based on a TOSCA description.</span> ...@@ -227,11 +227,13 @@ provisopned based on a TOSCA description.</span>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/provisioner/all</span> <td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/provisioner/all</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/ids</span> </samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/ids</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/provision</span> </samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/provision</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/sample</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/{id}</span> </samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/{id}</span>
</samp></li></ul></td> </samp></li></ul></td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="label label-default resource-method">DELETE</span> <td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="label label-default resource-method">DELETE</span>
</samp></li><li><samp> <span class="label label-default resource-method">GET</span> </samp></li><li><samp> <span class="label label-default resource-method">GET</span>
</samp></li><li><samp> <span class="label label-default resource-method">POST</span> </samp></li><li><samp> <span class="label label-default resource-method">POST</span>
</samp></li><li><samp> <span class="label label-default resource-method">GET</span>
</samp></li><li><samp> <span class="label label-default resource-method">DELETE</span> <span class="label label-default resource-method">GET</span> </samp></li><li><samp> <span class="label label-default resource-method">DELETE</span> <span class="label label-default resource-method">GET</span>
</samp></li></ul></td> </samp></li></ul></td>
<td> <span class="resource-description">This controller is responsible for obtaining resources from cloud providers <td> <span class="resource-description">This controller is responsible for obtaining resources from cloud providers
......
...@@ -69,7 +69,7 @@ class</p> ...@@ -69,7 +69,7 @@ class</p>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Subtypes</dt> <dt>Subtypes</dt>
<dd><a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_KeyPair.html">KeyPair</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_PlanResponse.html">PlanResponse</a>, <a href="json_PlaybookRepresentation.html">PlaybookRepresentation</a>, <a href="json_Script.html">Script</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_ToscaRepresentation.html">ToscaRepresentation</a>, <a href="json_CloudCredentials.html">CloudCredentials</a></dd> <dd><a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_KeyPair.html">KeyPair</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_PlanResponse.html">PlanResponse</a>, <a href="json_PlaybookRepresentation.html">PlaybookRepresentation</a>, <a href="json_Script.html">Script</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_ToscaRepresentation.html">ToscaRepresentation</a>, <a href="json_CloudCredentials.html">CloudCredentials</a></dd>
</dl> </dl>
<table class="table datatype-properties"> <table class="table datatype-properties">
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<div class="row"> <div class="row">
<div class="col-sm-3 col-md-2 sidebar" id="apinav"> <div class="col-sm-3 col-md-2 sidebar" id="apinav">
<ul class="nav nav-sidebar"> <ul class="nav nav-sidebar">
<li><a href="#resource_KeyPairController_postKey_POST">POST /user/v1.0/keys</a></li> <li><a href="#resource_KeyPairController_postKeyPair_POST">POST /user/v1.0/keys</a></li>
<li><a href="#resource_KeyPairController_deleteAll_DELETE">DELETE /user/v1.0/keys/all</a></li> <li><a href="#resource_KeyPairController_deleteAll_DELETE">DELETE /user/v1.0/keys/all</a></li>
<li><a href="#resource_KeyPairController_getIds_GET">GET /user/v1.0/keys/ids</a></li> <li><a href="#resource_KeyPairController_getIds_GET">GET /user/v1.0/keys/ids</a></li>
<li><a href="#resource_KeyPairController_geta_GET">GET /user/v1.0/keys/sample</a></li> <li><a href="#resource_KeyPairController_geta_GET">GET /user/v1.0/keys/sample</a></li>
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
be used by the provisoner to allow the user to login to the VMs from the be used by the provisoner to allow the user to login to the VMs from the
machine the keys correspond to.</p> machine the keys correspond to.</p>
<div id="resource_KeyPairController_postKey_POST"> <div id="resource_KeyPairController_postKeyPair_POST">
<h3><span class="label label-default resource-method">POST</span> <span class="resource-path">/user/v1.0/keys <a href="../user/v1.0/keys" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3> <h3><span class="label label-default resource-method">POST</span> <span class="resource-path">/user/v1.0/keys <a href="../user/v1.0/keys" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
<p>Posts the Key and stores it. The Key is a container for public pair <p>Posts the Key and stores it. The Key is a container for public pair
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<li><a href="#resource_ProvisionController_deleteAll_DELETE"><abbr title="DELETE /user/v1.0/provisioner/all">DELETE /user/v1.0/provisioner/...</abbr></a></li> <li><a href="#resource_ProvisionController_deleteAll_DELETE"><abbr title="DELETE /user/v1.0/provisioner/all">DELETE /user/v1.0/provisioner/...</abbr></a></li>
<li><a href="#resource_ProvisionController_getIds_GET">GET /user/v1.0/provisioner/ids</a></li> <li><a href="#resource_ProvisionController_getIds_GET">GET /user/v1.0/provisioner/ids</a></li>
<li><a href="#resource_ProvisionController_provision_POST"><abbr title="POST /user/v1.0/provisioner/provision">POST /user/v1.0/provisioner/pr...</abbr></a></li> <li><a href="#resource_ProvisionController_provision_POST"><abbr title="POST /user/v1.0/provisioner/provision">POST /user/v1.0/provisioner/pr...</abbr></a></li>
<li><a href="#resource_ProvisionController_sample_GET"><abbr title="GET /user/v1.0/provisioner/sample">GET /user/v1.0/provisioner/sam...</abbr></a></li>
<li><a href="#resource_ProvisionController_delete_DELETE"><abbr title="DELETE /user/v1.0/provisioner/{id}">DELETE /user/v1.0/provisioner/...</abbr></a></li> <li><a href="#resource_ProvisionController_delete_DELETE"><abbr title="DELETE /user/v1.0/provisioner/{id}">DELETE /user/v1.0/provisioner/...</abbr></a></li>
<li><a href="#resource_ProvisionController_get_GET"><abbr title="GET /user/v1.0/provisioner/{id}">GET /user/v1.0/provisioner/{id...</abbr></a></li> <li><a href="#resource_ProvisionController_get_GET"><abbr title="GET /user/v1.0/provisioner/{id}">GET /user/v1.0/provisioner/{id...</abbr></a></li>
<li class="divider"></li> <li class="divider"></li>
...@@ -226,7 +227,7 @@ Content-Type: application/json ...@@ -226,7 +227,7 @@ Content-Type: application/json
<div id="resource_ProvisionController_provision_POST"> <div id="resource_ProvisionController_provision_POST">
<h3><span class="label label-default resource-method">POST</span> <span class="resource-path">/user/v1.0/provisioner/provision <a href="../user/v1.0/provisioner/provision" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3> <h3><span class="label label-default resource-method">POST</span> <span class="resource-path">/user/v1.0/provisioner/provision <a href="../user/v1.0/provisioner/provision" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
<p>Provison the resources specified by a plan.</p> <p>Provision the resources specified by a plan.</p>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Security Roles Allowed</dt> <dt>Security Roles Allowed</dt>
...@@ -335,6 +336,90 @@ Content-Type: application/json ...@@ -335,6 +336,90 @@ Content-Type: application/json
</div> </div>
</div> </div>
<div id="resource_ProvisionController_sample_GET">
<h3><span class="label label-default resource-method">GET</span> <span class="resource-path">/user/v1.0/provisioner/sample <a href="../user/v1.0/provisioner/sample" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
<p></p>
<dl class="dl-horizontal">
<dt>Security Roles Allowed</dt>
<dd>ADMIN, USER</dd>
</dl>
<table class="table resource-response-codes">
<caption>Response Codes</caption>
<thead>
<tr>
<th>code</th>
<th>condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="label label-warning response-code">401</span></td>
<td><span class="response-condition">Bad credentials</span></td>
</tr>
</tbody>
</table>
<table class="table resource-response-body">
<caption>Response Body</caption>
<thead>
<tr>
<th>media type</th>
<th>data type</th>
</tr>
</thead>
<tbody>
<tr>
<td><abbr data-toggle="tooltip" data-placement="top" title="Use the &quot;Accept: application/json&quot; HTTP header to request that this media type be provided by the server."><span class="response-type">application/json</span></abbr></td>
<td><span class="datatype-reference"><a href="json_ProvisionRequest.html">ProvisionRequest</a>
(JSON)</span></td>
</tr>
<tr>
<td><abbr data-toggle="tooltip" data-placement="top" title="Use the &quot;Accept: application/xml&quot; HTTP header to request that this media type be provided by the server."><span class="response-type">application/xml</span></abbr></td>
<td><span class="datatype-reference"><a href="xml_ns0_provisionRequest.html">provisionRequest</a>
(XML)</span></td>
</tr>
</tbody>
</table>
<h4>Example</h4>
<div class="container-fluid example panel">
<div class="row panel-body">
<div class="col-md-6">
<h5>Request</h5>
<pre>
GET /user/v1.0/provisioner/sample
Accept: application/json
</pre>
</div>
<div class="col-md-6">
<h5>Response</h5>
<pre>
HTTP/1.1 200 Looks Good
Content-Type: application/json
<code class="prettyprint language-js">
{
&quot;cloudCredentialsIDs&quot; : [ &quot;58e3946e0fb4f562d84ba1ad&quot;, &quot;...&quot; ],
&quot;planID&quot; : &quot;ASedsfd46b4fDFd83ba1q&quot;,
&quot;keyPairIDs&quot; : [ &quot;ASedsfd46b4fFd344a1A&quot;, &quot;...&quot; ],
&quot;keyValue&quot; : {
&quot;property1&quot; : { },
&quot;property2&quot; : { }
},
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;
}
</code>
</pre>
</div>
</div>
</div>
</div>
<div id="resource_ProvisionController_delete_DELETE"> <div id="resource_ProvisionController_delete_DELETE">
<h3><span class="label label-default resource-method">DELETE</span> <span class="resource-path">/user/v1.0/provisioner/{id} <a href="../user/v1.0/provisioner/{id}" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3> <h3><span class="label label-default resource-method">DELETE</span> <span class="resource-path">/user/v1.0/provisioner/{id} <a href="../user/v1.0/provisioner/{id}" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
......
...@@ -219,11 +219,13 @@ provisopned based on a TOSCA description.</span> ...@@ -219,11 +219,13 @@ provisopned based on a TOSCA description.</span>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/provisioner/all</span> <td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/provisioner/all</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/ids</span> </samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/ids</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/provision</span> </samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/provision</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/sample</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/{id}</span> </samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/{id}</span>
</samp></li></ul></td> </samp></li></ul></td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="label label-default resource-method">DELETE</span> <td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="label label-default resource-method">DELETE</span>
</samp></li><li><samp> <span class="label label-default resource-method">GET</span> </samp></li><li><samp> <span class="label label-default resource-method">GET</span>
</samp></li><li><samp> <span class="label label-default resource-method">POST</span> </samp></li><li><samp> <span class="label label-default resource-method">POST</span>
</samp></li><li><samp> <span class="label label-default resource-method">GET</span>
</samp></li><li><samp> <span class="label label-default resource-method">DELETE</span> <span class="label label-default resource-method">GET</span> </samp></li><li><samp> <span class="label label-default resource-method">DELETE</span> <span class="label label-default resource-method">GET</span>
</samp></li></ul></td> </samp></li></ul></td>
<td> <span class="resource-description">This controller is responsible for obtaining resources from cloud providers <td> <span class="resource-description">This controller is responsible for obtaining resources from cloud providers
......
...@@ -72,8 +72,8 @@ public class DeployController { ...@@ -72,8 +72,8 @@ public class DeployController {
DeployRequest sample() { DeployRequest sample() {
DeployRequest req = new DeployRequest(); DeployRequest req = new DeployRequest();
req.setManagerType("ansible"); req.setManagerType("ansible");
req.setConfigurationID("Configuration_ID"); req.setConfigurationID("58e2681ba9961baa096c8541");
req.setProvisionID("Provision_ID"); req.setProvisionID("58f8dd3a2af41387c32ff602");
return req; return req;
} }
......
...@@ -120,7 +120,7 @@ public class ProvisionController { ...@@ -120,7 +120,7 @@ public class ProvisionController {
} }
/** /**
* Provison the resources specified by a plan. * Provision the resources specified by a plan.
* *
* @param req. The ProvisionRequest. This is a container the plan ID, cloud * @param req. The ProvisionRequest. This is a container the plan ID, cloud
* credent ID, etc. * credent ID, etc.
...@@ -147,4 +147,20 @@ public class ProvisionController { ...@@ -147,4 +147,20 @@ public class ProvisionController {
return null; return null;
} }
@RequestMapping(value = "/sample", method = RequestMethod.GET)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
ProvisionRequest sample() {
ProvisionRequest req = new ProvisionRequest();
List<String> cloudCredentialsIDs = new ArrayList<>();
cloudCredentialsIDs.add("58f8d74f2af451b88c779d7a");
cloudCredentialsIDs.add("438dAFDf2ead451we8rf34Af");
req.setCloudCredentialsIDs(cloudCredentialsIDs);
List<String> keyPairIDs = new ArrayList<>();
keyPairIDs.add("58f8da042af45d6621813c4e");
req.setKeyPairIDs(keyPairIDs);
req.setPlanID("58da51f7f7b42e7d967752a1");
return req;
}
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
package nl.uva.sne.drip.data.v1.external; package nl.uva.sne.drip.data.v1.external;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.webcohesion.enunciate.metadata.DocumentationExample; import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.util.List; import java.util.List;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
...@@ -83,4 +84,5 @@ public class ProvisionRequest extends KeyValueHolder { ...@@ -83,4 +84,5 @@ public class ProvisionRequest extends KeyValueHolder {
public void setKeyPairIDs(List<String> userKeyID) { public void setKeyPairIDs(List<String> userKeyID) {
this.keyPairIDs = userKeyID; this.keyPairIDs = userKeyID;
} }
} }
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAm6AALYxkJFNzD3bfVJ4+hMY5j0/kqM9CURLKXMlYuAysnvoG8wZKx9Bedefm
eNSse4zTg798ZA2kDMZFIrwp1AseTwtj8DDu5fhG5DjyI3g6iJltS5zFQdMXneDlHXBX8cncSzNY
Rx0NdjEMAe7YttvI8FNlxL0VnMFli/HB/ftzYMe5+AmkSROncVGHiwoiUpj+vtobCFOYtXsCf6ri
d4lgWA5wv6DZT/JKCYymiBqgSXu3ueFcEzw5SAukARWVjn1xccjZkokFfBbO/FpYY00TrUTBw9S6
D3iM+gj8RT6EKILOmhrt71D21S95WAWIT7h2YBsy1KAvMixhNf9VaQIDAQABAoIBAHhVYK3Xl3tr
N1Xm0ctJTQg3ijxhR2qsUBgGUokqezpdOoD2zbbOz7XvTYsX1GLr967U9pwxzUpELexexwiTvDgk
nLv8D7ui6qbRsmc4DSsWBRSophVIVFKQmftO8Xow6x+fuYJAYmsicM1KIYHBILtL+PSzV8anenWq
KQ3r0tfCiQhEzKEk4b1uT3SJWQyHE++JAhVkO7lIeb6S9Dg1jAaAeMnJ/NiMxTarpPRnxe6hsTsH
gG1iKWo+Skcl4SknOc+CMEfyDjG4FL7MGhKduahsO8vMUrgGsDD7EH3NiX/FweB8La6qpDYAwFpC
ycrooyhiyzw8Wb5gGaYnmvr9l70CgYEAx74O8JleXaHpxEAmh4h7VbLmJ3mOylfBmOdzcHeedJQw
ack2SAv65WBI9S9MEQ7J/vFuyw5HNk3C/mcWgzDQXSNIhHLvl/Z9sux/Qpm3SQWLz0RBxKV3dJ4r
wcAxzVA93+/L1Nee+VOKnlyRumvVa6+XLsLagpap2AVcTqlerMcCgYEAx3T2pXtqkCE9eU/ov22r
pdaKjgHoGOU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GAGTgFuq9Zojh/KIqY8b4HpEfmh6CQ
hLVfD98Nqd6GDbxgvIM0v4mFXE92x2jn35Ia0JdFyh3B8Vkl7sqQZfxDFXI9O9pte2mPJxY9ICaY
55+X/SN1pd53BH+gaPZJy/R+Vpvs5MN48howjUKy5UKpoFeUWrS5QArjtvNCm4SGlXw=
-----END RSA PRIVATE KEY-----
---
- hosts: all
tasks:
- name: install sysbench
apt: name="{{ item }}" update_cache=yes state=latest
with_items: [phoronix-test-suite, sysbench, expect, git, python-pexpect, php-zip]
become: true
- {name: Phoronix-test-suite accept User Agreement, command: 'expect -c "spawn phoronix-test-suite;
expect \"Do you agree to these terms and wish to proceed \(Y/n\):\"; send \"Y
\"; expect \"Enable anonymous usage / statistics reporting \(Y/n\):\"; send
\"n \"; expect \"Enable anonymous statistical reporting of installed software
/ hardware \(Y/n\):\"; send \"n \"; interact;"', become: true}
- {name: Install stream, command: phoronix-test-suite install-test stream, become: true}
- {name: Install iozone, command: phoronix-test-suite install-test iozone, become: true}
- {name: Count vCPU, command: nproc, register: vcpunumber, become: true}
- {debug: 'msg="{{ vcpunumber.stdout }}"'}
- {name: Run sysbench, command: 'sysbench --test=cpu --cpu-max-prime=100000 --num-threads={{
vcpunumber.stdout }} run', register: sysbenchoutput, become: true}
- {debug: 'msg="{{ sysbenchoutput.stdout }}"'}
- {name: Run stream, command: 'expect -c "spawn phoronix-test-suite run-test stream;
expect \"Type:\"; send \"4 \"; expect \"\(Y/n\):\"; send -- \"y\r\"; expect
\"Enter a name to save these results under:\"; send \"out \"; expect \"Enter
a unique name to describe this test run / configuration:\"; send -- \"unique\r\";
expect \"New Description:\"; send \"\r\"; expect \"Would you like to upload
the results to OpenBenchmarking.org (Y/n):\"; send \"n\r\"; interact;"', register: streamoutput,
become: true}
- {debug: 'msg="{{ streamoutput.stdout }}"'}
- {name: Run iozone, command: 'expect -c "spawn phoronix-test-suite run-test iozone;
expect \"Record Size:\"; send \"2 \"; expect \"File Size:\"; send \"2 \"; expect
\"Disk Test:\"; send \"3 \"; expect \"\(Y/n\):\"; send -- \"y\r\"; expect \"Enter
a name to save these results under:\"; send \"out \"; expect \"Enter a unique
name to describe this test run / configuration:\"; send -- \"unique\r\"; expect
\"New Description:\"; send \"\r\"; expect \"Would you like to upload the results
to OpenBenchmarking.org (Y/n):\"; send \"n\r\"; interact;"', register: iozoneoutput,
become: true}
- {name: Get stream results, command: phoronix-test-suite result-file-to-csv out,
register: streamoutput, become: true}
- {debug: 'msg="{{ streamoutput.stdout }}"'}
...@@ -59,8 +59,8 @@ def install_prerequisites(vm): ...@@ -59,8 +59,8 @@ def install_prerequisites(vm):
stdout.read() stdout.read()
parentDir = os.path.dirname(os.path.abspath(vm.key)) parentDir = os.path.dirname(os.path.abspath(vm.key))
#os.chmod(parentDir, 700) os.chmod(parentDir, 0o700)
os.chmod(vm.key, 0o444) os.chmod(vm.key, 0o600)
print "Ansible prerequisites installed in: %s " % (vm.ip) print "Ansible prerequisites installed in: %s " % (vm.ip)
except Exception as e: except Exception as e:
print '%s: %s' % (vm.ip, e) print '%s: %s' % (vm.ip, e)
...@@ -74,15 +74,16 @@ def execute_playbook(hosts, playbook_path,user,ssh_key_file,extra_vars,passwords ...@@ -74,15 +74,16 @@ def execute_playbook(hosts, playbook_path,user,ssh_key_file,extra_vars,passwords
print '[ERROR] The playbook does not exist' print '[ERROR] The playbook does not exist'
return '[ERROR] The playbook does not exist' return '[ERROR] The playbook does not exist'
os.environ['ANSIBLE_HOST_KEY_CHECKING'] = 'False'
variable_manager = VariableManager() variable_manager = VariableManager()
loader = DataLoader() loader = DataLoader()
inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=hosts) inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=hosts)
Options = namedtuple('Options', ['listtags', 'listtasks', 'listhosts', 'syntax', 'connection','module_path', 'forks', 'remote_user', 'private_key_file', 'ssh_common_args', 'ssh_extra_args', 'sftp_extra_args', 'scp_extra_args', 'become', 'become_method', 'become_user', 'verbosity', 'check']) Options = namedtuple('Options', ['listtags', 'listtasks', 'listhosts', 'syntax', 'connection','module_path', 'forks', 'remote_user', 'private_key_file', 'ssh_common_args', 'ssh_extra_args', 'sftp_extra_args', 'scp_extra_args', 'become', 'become_method', 'become_user', 'verbosity', 'check', 'aaaaaaaaaaa'])
options = Options(listtags=False, listtasks=False, listhosts=False, syntax=False, connection='smart', module_path=None, forks=None, remote_user=user, private_key_file=ssh_key_file, ssh_common_args=None, ssh_extra_args=None, sftp_extra_args=None, scp_extra_args=None, become=True, become_method='sudo', become_user='root', verbosity=None, check=False) options = Options(listtags=False, listtasks=False, listhosts=False, syntax=False, connection='smart', module_path=None, forks=None, remote_user=user, private_key_file=ssh_key_file, ssh_common_args=None, ssh_extra_args=None, sftp_extra_args=None, scp_extra_args=None, become=True, become_method='sudo', become_user='root', verbosity=None, check=False , aaaaaaaaaaa=False)
variable_manager.extra_vars = extra_vars variable_manager.extra_vars = extra_vars
...@@ -129,4 +130,5 @@ def run(vm_list,playbook_path): ...@@ -129,4 +130,5 @@ def run(vm_list,playbook_path):
extra_vars = {} extra_vars = {}
passwords = {} passwords = {}
print "Executing playbook: %s " % (playbook_path)
return execute_playbook(hosts,playbook_path,user,ssh_key_file,extra_vars,passwords) return execute_playbook(hosts,playbook_path,user,ssh_key_file,extra_vars,passwords)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment