As I mentioned earlier, I'm going to keep everyone updated as
ansible-commander evolves. What you now see in the repo
is the result of only a few hours of hacking.
As it turns out, as is always the case, that the latest shiny toys you
want to use on CentOS 6 are never there. In this case, the psycopg2
extensions for hstore were MIA, so I decided to not use hstore --
which also makes things easier to set up. Ah well. I don't think we
need it, and it will lower the complexity of the SQL anyway.
https://github.com/ansible/ansible-commander/blob/master/acom/data.py
This is a really rough sketch of a NewSql-style data layer in
Postgres, as you can see, adding a new type of object
is going to be pretty simple. It's following the Reddit model of only
having two tables, so we don't have to worry about migrations.
There's more to add like a function to check the data types and
general sanity, but you can see the basics here.
This is enough to start plumbing up the basics of the REST API.
One of the things the REST API is going to have to do is keep track of
some cached data, so when we add a group to a parent group it will
keep up all the kid hosts and grandkid groups, etc -- to make things
nice and fast. The API will not allow editing these, but will be
updated behind the scenes when edits are made. This is still left to
be done.
So, the next step is to flesh out the REST API for groups to the point
where we can exercise it.
Users will work just like groups. The app will automatically insert
a default user if there are none, and you'll be able to edit your
password using the REST API. API users will never need to know the
database password, but there is one, and the Ansible app can only
access the Ansible database.
--Michael