Skip to content
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

Feature request: support dynamic inventories #33

Closed
azimut opened this issue Sep 22, 2015 · 12 comments
Closed

Feature request: support dynamic inventories #33

azimut opened this issue Sep 22, 2015 · 12 comments

Comments

@azimut
Copy link

azimut commented Sep 22, 2015

Example output of a dynamic inventory script. Where IMAP is a group name, ipaddr a host variable and virt16.example.com a host.

{
    "IMAP": {
        "hosts": [
            "virt16.example.com"
        ]
    },
    "_meta": {
        "hostvars": {
            "virt16.dte3.netsol.com": {
                "ipaddr": "1.1.1.1"
            }
        }
    }
}
@fboender
Copy link
Owner

Thanks, I'm going to implement a way of handling dynamic inventories. It might take a few days, as I'm kind of pressed for time at the moment.

@fboender
Copy link
Owner

Hey Azimut!

I've commited a set of changes that implement dynamic inventory scanning. I had to implement it against your example, examples from the Ansible documentation and the (rather broken) virtualbox dynamic inventory contrib script. It works for me, but most of the stuff I tested against has been basically mockups.

Can you give it a test spin; see how it works out for you? You'll have to clone the repo, as there's no packaged release with the changes yet.

Thanks for the suggestion!

Regards,

Ferry

@smiller171
Copy link

Hey, I just stumbled across this. I think I'll give it a shot against my 100+ node dynamic inventory this week

@fboender
Copy link
Owner

Hey Scott!

Please do! I'm curious if I got it right. ;-)

Thanks!
On Sep 27, 2015 5:24 AM, "Scott Miller" notifications@github.com wrote:

Hey, I just stumbled across this. I think I'll give it a shot against my
100+ node dynamic inventory this week


Reply to this email directly or view it on GitHub
#33 (comment)
.

@azimut
Copy link
Author

azimut commented Sep 28, 2015

Thanks for you work! Somehow it's not working for me. Should this work when a directory is passed to the -i argument and a dyn inventory is present on that dir?

@fboender
Copy link
Owner

No, the argument to -i should point directly to the script itself. Is what you describe supported by Ansible? I don't think I read that in the docs, but I could have missed it. In that case, I'll implement it.

@azimut
Copy link
Author

azimut commented Sep 29, 2015

Yup, it's here using-multiple-inventory-sources:

... When doing so, it is possible to mix both dynamic and statically managed inventory sources in the same ansible run. Instant hybrid cloud!

Thanks again!

@fboender
Copy link
Owner

Alright, I'll fix this so multiple inventory sources are supported. Thanks!

@smiller171
Copy link

@fboender if it doesn't already, you should check the ansible configuration for the default inventory path.

@fboender
Copy link
Owner

fboender commented Oct 3, 2015

Multiple inventory sources are now supported in the latest master. I'm going to close this issue. If it turns out something doesn't work properly, please re-open it or create a new issue. Thanks!

@smiller171 I will create a new feature request for that. It's a good idea, since Ansible itself also doesn't need to be pointed to the inventory path.

@fboender fboender closed this as completed Oct 3, 2015
@azimut
Copy link
Author

azimut commented Oct 3, 2015

@fboender Thanks, it works for me.

@fboender
Copy link
Owner

fboender commented Oct 3, 2015

@azimut Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants