Added missing main.yml, docker.yml for Astute, fixed graph outputting

This commit is contained in:
Przemyslaw Kaminski 2015-04-17 13:24:30 +02:00
parent f7de6b9797
commit a4fe14aae9
4 changed files with 43 additions and 4 deletions

View File

@ -80,6 +80,9 @@ python cli.py resource show rs/mariadb_keystone_data # --> IP is 1.1.1.1
# View connections
python cli.py connections show
# Outputs graph to 'graph.png' file, please note that arrows don't have "normal" pointers, but just the line is thicker
# please see http://networkx.lanl.gov/_modules/networkx/drawing/nx_pylab.html
python cli.py connections graph
# Disconnect

17
cli.py
View File

@ -1,5 +1,8 @@
import click
import json
import matplotlib
matplotlib.use('Agg') # don't show windows
import matplotlib.pyplot as plt
import networkx as nx
import os
@ -100,11 +103,17 @@ def init_cli_connections():
connections.add_command(show)
# TODO: this requires graphing libraries
#@click.command()
#def graph():
# nx.draw_graphviz(xs.connection_graph())
@click.command()
def graph():
g = xs.connection_graph()
pos = nx.spring_layout(g)
nx.draw_networkx_nodes(g, pos)
nx.draw_networkx_edges(g, pos, arrows=True)
nx.draw_networkx_labels(g, pos)
plt.axis('off')
plt.savefig('graph.png')
#connections.add_command(graph)
connections.add_command(graph)
if __name__ == '__main__':

8
docker.yml Normal file
View File

@ -0,0 +1,8 @@
- hosts: all
sudo: yes
tasks:
- shell: docker --version
ignore_errors: true
register: docker_version
- shell: curl -sSL https://get.docker.com/ | sudo sh
when: docker_version | failed

19
main.yml Normal file
View File

@ -0,0 +1,19 @@
---
- hosts: all
sudo: yes
tasks:
# Setup additional development tools
- apt: name=vim state=present
- apt: name=tmux state=present
- apt: name=htop state=present
- apt: name=python-virtualenv state=present
- apt: name=virtualenvwrapper state=present
- apt: name=ipython state=present
- apt: name=python-pudb state=present
# Graph drawing
- apt: name=python-matplotlib state=present
# Setup development env for solar
#- shell: python setup.py develop chdir=/vagrant/solar