New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate OpenStack Ansible inventory #12
Comments
I've put a few months of work in the openstack-ansible dynamic_inventory.py file. Would you like some help with this? |
In particular, I'm not seeing that Craton has concepts that map to OpenStack-Ansible's environment structures, which describes how various service containers map to hosts. Is this in scope for the project? http://docs.openstack.org/developer/openstack-ansible/install-guide/app-custom-layouts.html has information on how the current environment configuration works, and http://docs.openstack.org/developer/openstack-ansible/developer-docs/inventory.html has a high level overview of how we already generate our inventory. |
@nrb any help from OSA team is welcome :) I've had a few chat with @odyssey4me from OSA team re the points you raise above and we are meeting early next week to clear these points out. Perhaps we should have a joint convo on this ? re: mapping to OSA env structure, yes it in the scope in a more generic term. We support labeling host .. and are looking at labels support hierarchies etc, which will map host->service or any obj -> other obj. I think this will work for OSA env as well (hopefully for as is). The part that I mostly want to solve right now is to make sure we can generate all the host groups you guys use (which is a lot ;) ) in generic enough way that it work for OSA but also for any other ansible inventory. Same applies to vars / hostvars ... such that OSA can choose between using the file based structure you have now or switch toward craton. The plugin based approach work you guys started looks particular interesting at that point: In any case lets have a chat next week and go from there. |
Also see: #110 |
@sulochan @jimbaker I think we should do a kick off chat to discuss next steps. I think we need to prepare to have some sort of testable inventory usage from Craton for OpenStack-Ansible in the Ocata cycle. Ideally the kick-off should include both @nrb (US-based) and @neillc (AUS-based) but the time zone co-ordination may be difficult. Fundamentally I'd like to be clear that instead of having Craton generate the files for an OSA inventory, we would rather implement a pluggable library into the OSA dynamic inventory that can be configured to use the files (for gate tests and small environment testing) or to use Craton (or any other inventory system given the appropriate plugin). OSA should implicitly get all host/group details (including container names and addresses) and all configuration that overrides defaults from the inventory system. This may require implementing some tooling to 'import' required default host groups, to 'generate' container host entries, and also to implement IP address allocation for the containers (perhaps via a plugin to an IPAM system). These should be actions that are only done on occasion (probably before major upgrades). These are details we need to hash out though. In principle I'd like to ensure that instead of generating flat files based on data from Craton, that we dynamically read the data from Craton and OSA should simply trust Craton as the inventory with all the information it needs to deploy an environment. |
@sulochan So this would require deployers to define that structure manually for each deployment? It seems that there would need to be some way to provide Craton with a hierarchy in such a way that users don't have to enter the same thing every time; I would think some kind of import as mentioned above would be a solution. The linked reviews were indeed the start of a pluggable system, though I think they'll need to be revisited due to the age and some other code clean up changes that happened to the dynamic_inventory. |
@nrb yeah absolutely agree. idea is to come up with templates such that users can easily put this data into the system without repeat. We had some chat re: inventory and how to make it easy for end users to push OSA required data (for new and for existing OSA deploys) and consume it back etc. This is what the thinking is so far: From high level, Craton will provide the following:
OSA can then use teh pluggable system discussed above to either point to files (existing) or towards craton. Using craton should provide more functionality such as: |
Is the OSA inventory discussion, someone passed this to me and it has a lot of info that is relevant to this discussion. Note: some of the req's there is already implemented or being implemented currently. |
For the point 3) above, this is not the expected ansible behavior, but it's indeed OSA behavior. So I guess we could workaround that. I don't think it should be part of craton's scope anyway, because OSA can have a merged view from different sources, and define what we need, independently of craton. For the a) above, I'll maybe rephrase what I said in a previous meeting: ansible can handle its own collection of facts, or re-use a facts collector. We just need to know what we can/should trust as fact collector, and make appropriate design decisions. I think there is something missing right now from the list of features, is constraints per variable type. |
In OSA's current model, not all hosts are known at the start. The dynamic inventory script creates the container names/IP addresses and inserts them into the inventory so that LXC playbooks and roles can create them. This could be modified to send that information to Craton first, though. This is similar to @evrardjp's concern - is it within Craton's scope to actually generate this information? Or is Craton only meant to store? I know many OSA contributors would like to completely hand off the generation, but I'm not so sure it can be done cleanly, since any system that would do such a thing must be aware of said constraints somehow, so OSA would at least have to provide those. Along the same lines of the Kind of thinking aloud as I type, but I'm assuming these would be assigned to group variables outside of Craton? These are, again, mostly used in container creation, which is currently done via LXC playbooks and roles, not with a centralized system. |
A question about this assumption
In private cloud scenarios, especially many currently deployed, there's only one region. I'm going to assume Craton itself doesn't care what it would be called, but OSA may want to decide on a generic region name to use for single-region installs. |
@nrb this is the exact case i discussed with @odyssey4me So in general craton inventory is only supposed to store. There is nothing in the inventory itself that does this, BUT, the template that i was talking about previously, is a client side code, that will allow to do such things .. for instance we will only ask for the min required subset of things. For example the cidr range to use for your container networks, then if you choose the default template .. container name, ip assignment etc will be auto generated for all containerized services from the list of hosts available (assuming the hosts have been pushed into the system at this point), and user and obviously choose to put this info manually. Some of the exact implementation details will need to be hashed out though. But whats your thoughts on something like this ? |
On Thu, 7 Jul 2016 at 01:34 Sulochan Acharya notifications@github.com
Fwiw, I recommend we generate the ansible inventory on the REST client
|
On Fri, 1 Jul 2016 at 21:45 Jesse Pretorius notifications@github.com
Does a direct-craton-query version introduce (larger) consistency problems? Specifically, if a long OSA run takes (eg) a day to complete, then that's a We still have a small version of this problem when generating files, but
|
yeah, + 1 This is what i was suggesting initially as well. In a way we are already providing the api to do this .. i.e what is done internally is just logic on top of host, cell, region queries ... which works just the same if it were a client making that rest api call and doing that processing client side. I think what we need to figure out is what value can we add by doing it craton side .. without being OSA specific ... i think its probably not too bad to provide ansible specific inventory endpoint but we definitely should not get tied to OSA and vice versa such that one needs a change in the other code base to work. |
In the current system, only the IP addresses and hostnames for containers are new values inserted into the inventory. Everything else should be variables in YAML formatted into JSON. So, there does exist the possibility of editing files by hand during deploy, but the files are ingested exactly once per run, I agree with not hard-coupling either project to each other. However, there are certain constraints that the OSA system expects, such as generating IP addresses that aren't already in use. My sense is that the core OSA team would like to move this functionality out of the OSA repository, but I don' tthink Craton is the right place for it, either. More likely, some sort of client-side code would do this work and send it to Craton. I'm of the opinion that should be in the OSA side. I'm not enthusiastic about creating another project just to handle that part. |
Script/corresponding common library code using underlying SQLAlchemy model representation that generates Ansible inventory files that's suitable for using with OpenStack Ansible.
The text was updated successfully, but these errors were encountered: