<div dir="ltr"><div>So Ansible is supposed to be already installed and available on the machine / (docker container)  running Hawkular Services, right ?</div><div><br></div><div>Thomas</div><div>  </div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 15, 2016 at 3:57 AM, John Mazzitelli <span dir="ltr">&lt;<a href="mailto:mazz@redhat.com" target="_blank">mazz@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Slight change - I found out there is a feature in feature-pack stuff that let you ship with direct file content that gets copied into the server. So I put the Ansible scripts in the feature pack. This is the correct way to do it. Now anyone building the server with the feature pack (integration tests, for example) will get the Ansible integration as well.<br>
<br>
So link [3] changes from my original email. It is now:<br>
<br>
[3] <a href="https://github.com/jmazzitelli/hawkular-services/tree/HAWKULAR-1096-ansible-commands/feature-pack/src/main/content/standalone/configuration/ansible" rel="noreferrer" target="_blank">https://github.com/jmazzitelli/hawkular-services/tree/HAWKULAR-1096-ansible-commands/feature-pack/src/main/content/standalone/configuration/ansible</a><br>
<div class="HOEnZb"><div class="h5"><br>
----- Original Message -----<br>
&gt; I have a very simple PoC working that shows Ansible integrated with Hawkular<br>
&gt; such that it can start a WildFly server remotely.<br>
&gt;<br>
&gt; I&#39;ll begin with a brief summary.<br>
&gt;<br>
&gt; SUMMARY<br>
&gt;<br>
&gt; A client connects to the Hawkular Server via its websocket and passes in a<br>
&gt; JSON request (like it does the other kinds of requests). The JSON request<br>
&gt; looks something like:<br>
&gt;<br>
&gt;   AnsibleRequest={&quot;playbook&quot;:&quot;start-wildfly.yml&quot;, &quot;extraVars&quot;: {<br>
&gt;   &quot;wildfly_home_dir&quot;:&quot;/opt/wildfly10&quot; } }<br>
&gt;<br>
&gt; The command-gateway server takes the request, runs the Ansible playbook, and<br>
&gt; returns the response back over the websocket to the client with an<br>
&gt; AnsibleResponse (which includes the Ansible output to show what it did).<br>
&gt;<br>
&gt; DETAILS<br>
&gt;<br>
&gt; The code is in two branches in my repos. See [1] and [2]. You need both for<br>
&gt; this to work.<br>
&gt;<br>
&gt; Hawkular-Services packages up Ansible playbooks and its associated files in<br>
&gt; standalone/configuration/ansible. See [3].<br>
&gt;<br>
&gt; Hawkular-Commons adds to command gateway a new JSON request/response for<br>
&gt; Ansible requests. See [4] and [5].<br>
&gt;<br>
&gt; The Ansible command is invoked in the server when the AnsibleRequest JSON is<br>
&gt; received over the websocket. This command implementation runs the Ansible<br>
&gt; playbook and returns the results back in a AnsibleResponse. See [6].<br>
&gt;<br>
&gt; If you build commons and then services to pull the new commons in, you can<br>
&gt; run a test to see it work. I use the test command CLI utility in the agent<br>
&gt; to do this [7]. First, build the new dist and run it so you have a Hawkular<br>
&gt; Service running (for example, &quot;mvn clean install -Pdev,embeddedc&quot;). Next,<br>
&gt; create a test JSON request file (say, &quot;/tmp/hawkular.json&quot;) with this<br>
&gt; content:<br>
&gt;<br>
&gt; { &quot;playbook&quot;:&quot;start-wildfly.yml&quot;,<br>
&gt;   &quot;extraVars&quot;: {<br>
&gt;      &quot;wildfly_home_dir&quot;:&quot;/directory/where/you/installed/wildfly&quot;<br>
&gt;   }<br>
&gt; }<br>
&gt;<br>
&gt; Now build the hawkular-agent from source (just so you get the test command<br>
&gt; CLI utility) and run the test command CLI, telling it to use the JSON in<br>
&gt; your file and send it to your Hawkular Service server:<br>
&gt;<br>
&gt; $ cd<br>
&gt; &lt;hawkular-agent-source-dir&gt;/hawkular-wildfly-agent-itest-parent/hawkular-wildfly-agent-command-cli/target<br>
&gt;<br>
&gt; $ java -jar hawkular-wildfly-agent-command-cli-*.jar --username jdoe<br>
&gt; --password password \<br>
&gt;        --command AnsibleRequest --request-file=/tmp/hawkular.json<br>
&gt;<br>
&gt; This sends the request to your local Hawkular Service server over the<br>
&gt; websocket, the Ansible playbook &quot;start-wildfly.yml&quot; is run, which starts the<br>
&gt; WildFly in that home dir you specified in your JSON request, and the<br>
&gt; response is sent back. The Command CLI tool will write the responses it<br>
&gt; receives to disk - look at the cli output for the names of the files it<br>
&gt; writes - you can look in there to see what the Ansible command response was<br>
&gt; (its just the full Ansible output).<br>
&gt;<br>
&gt; There is still LOTS to do here (for one, you&#39;ll notice it assumes your<br>
&gt; wildfly install is on &quot;localhost&quot; :)). This is merely a PoC that we can use<br>
&gt; as a starting point - it shows that this can be done and how we can do it.<br>
&gt;<br>
&gt; -- John Mazz<br>
&gt;<br>
&gt; [1]<br>
&gt; <a href="https://github.com/jmazzitelli/hawkular-commons/tree/HAWKULAR-1096-ansible-commands" rel="noreferrer" target="_blank">https://github.com/jmazzitelli/hawkular-commons/tree/HAWKULAR-1096-ansible-commands</a><br>
&gt; [2]<br>
&gt; <a href="https://github.com/jmazzitelli/hawkular-services/tree/HAWKULAR-1096-ansible-commands" rel="noreferrer" target="_blank">https://github.com/jmazzitelli/hawkular-services/tree/HAWKULAR-1096-ansible-commands</a><br>
&gt; [3]<br>
&gt; <a href="https://github.com/jmazzitelli/hawkular-services/tree/HAWKULAR-1096-ansible-commands/dist/src/main/resources/standalone/configuration/ansible" rel="noreferrer" target="_blank">https://github.com/jmazzitelli/hawkular-services/tree/HAWKULAR-1096-ansible-commands/dist/src/main/resources/standalone/configuration/ansible</a><br>
&gt; [4]<br>
&gt; <a href="https://github.com/jmazzitelli/hawkular-commons/blob/HAWKULAR-1096-ansible-commands/hawkular-command-gateway/hawkular-command-gateway-api/src/main/resources/schema/AnsibleRequest.schema.json" rel="noreferrer" target="_blank">https://github.com/jmazzitelli/hawkular-commons/blob/HAWKULAR-1096-ansible-commands/hawkular-command-gateway/hawkular-command-gateway-api/src/main/resources/schema/AnsibleRequest.schema.json</a><br>
&gt; [5]<br>
&gt; <a href="https://github.com/jmazzitelli/hawkular-commons/blob/HAWKULAR-1096-ansible-commands/hawkular-command-gateway/hawkular-command-gateway-api/src/main/resources/schema/AnsibleResponse.schema.json" rel="noreferrer" target="_blank">https://github.com/jmazzitelli/hawkular-commons/blob/HAWKULAR-1096-ansible-commands/hawkular-command-gateway/hawkular-command-gateway-api/src/main/resources/schema/AnsibleResponse.schema.json</a><br>
&gt; [6]<br>
&gt; <a href="https://github.com/jmazzitelli/hawkular-commons/blob/HAWKULAR-1096-ansible-commands/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/AnsibleCommand.java" rel="noreferrer" target="_blank">https://github.com/jmazzitelli/hawkular-commons/blob/HAWKULAR-1096-ansible-commands/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/AnsibleCommand.java</a><br>
&gt; [7]<br>
&gt; <a href="https://github.com/hawkular/hawkular-agent/tree/master/hawkular-wildfly-agent-itest-parent/hawkular-wildfly-agent-command-cli" rel="noreferrer" target="_blank">https://github.com/hawkular/hawkular-agent/tree/master/hawkular-wildfly-agent-itest-parent/hawkular-wildfly-agent-command-cli</a><br>
&gt; _______________________________________________<br>
&gt; hawkular-dev mailing list<br>
&gt; <a href="mailto:hawkular-dev@lists.jboss.org">hawkular-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/hawkular-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/hawkular-dev</a><br>
&gt;<br>
_______________________________________________<br>
hawkular-dev mailing list<br>
<a href="mailto:hawkular-dev@lists.jboss.org">hawkular-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/hawkular-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/hawkular-dev</a><br>
<br>
<br>
</div></div></blockquote></div><br></div>